Hey I'm new to python and working on a uni assignment and need help. So I have a query of cities and some properties to go with them and i need to print out a list of the bordering cities and the cities more south and west of the city of Guelph. Apparently it can be done in 3 lines but I just want to figure out how to get my code to work for now.
ontario = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "Guelph",
"border town?": "false"
},
"geometry": {
"type": "Point",
"coordinates": [-80.255126953125, 43.545561990655855]
}
}
]
}
citiesInOntario = ontario["features"]
for city in citiesInOntario:
if(city["properties"]["border town?"] == "true" and \
city["geometry"]["coordinates"][0] < -80.255 and \
city["geometry"]["coordinates"] < 43.545):
print(city["properties"]["name"])