# Michael Kirby
# 4/25/2022
# I didn't learn anything
# Sorry for the delay I forgot I still needed to turn this in. I'm not sure what the error is considering it worked
# [] create The Weather
# Imports mean_temp.txt
!curl https://raw.githubusercontent.com/MicrosoftLearning/intropython/master/world_temp_mean.csv -o mean_temp.txt
# Sets the variable mean_temp_file to open mean_temp.txt in a+ mode
mean_temp_file = open("mean_temp.txt","a+")
# Writes the following onto the end of mean_temp_file
mean_temp_file.write("\nRio de Janerio,Brazil,30.0,18.0")
# Brings the mean_temp_file pointer to the beginning of the file
mean_temp_file.seek(0)
# Sets the variable headings to read the first line of the file
headings = mean_temp_file.readline()
# Sets headings_list to split the first line at the commas
headings_list = headings.split(',')
# Displays headings_list
print(headings_list)
# Sets city_temp to read each line of mean_temp_file
city_temp = mean_temp_file.readline()
# Says while city_temp do this (FOREVER LOOP)
while city_temp:
# Sets city_temp_list to the variable city_temp split at the commas
city_temp_list = city_temp.split(",")
# Displays a combination of strings and indexes from both lists
print(headings_list[2],"for",city_temp_list[0],"is",city_temp_list[2],"Celsius")
# Reassigns city_temp
city_temp = mean_temp_file.readline()
# Closes the file variable mean_temp_file
mean_temp_file.close()
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 222 100 222 0 0 20181 0 --:--:-- --:--:-- --:--:-- 20181
['city', 'country', 'month ave: highest high', 'month ave: lowest low\n']
month ave: highest high for Beijing is 30.9 Celsius
month ave: highest high for Cairo is 34.7 Celsius
month ave: highest high for London is 23.5 Celsius
month ave: highest high for Nairobi is 26.3 Celsius
month ave: highest high for New York City is 28.9 Celsius
month ave: highest high for Sydney is 26.5 Celsius
month ave: highest high for Tokyo is 30.8 Celsius
Execution error
IndexError: list index out of range
print(city_temp_list)
['\n']