Sep-04-2019, 07:59 AM
(Sep-04-2019, 07:32 AM)starter_student Wrote: anyway I've changed it but till got the same KeyError: "list"it's on line 9 and 10 now. as I said you need to change these too.
city_names = [] min_temps = [] max_temps = [] for city in data['list']: city_names.append(city['name']) min_temps.append(city['main']['temp_min']) max_temps.append(city['main']['temp_max']) print(city_names) print(min_temps) print(max_temps)
Output:['Moscow', 'Kiev', 'London']
[23, 29, 16.67]
[25, 31.67, 20.56]
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