(Sep-04-2019, 08:09 AM)starter_student Wrote: what is wring with my codethe way you try to access different parts in the JSON object, e.g.
for city in data["list"]: cities.append(city["list"][1]["name"])you loop over each element in data['list']. That is each city data being
dict
. Then you try to access city['list']
- there is no such key within city dict. Then you even try (not sure what) to use index as in list i.e. [1]
or key=1 as in dict with int keys... again - city is not a list, nor there is key=1 in city dictsame apply to part where you try to get temps
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs