#Helina Hailu
#January 9, 2022
#I reviewed previous methods like input, while, open .split(), .readline(), .seek(), .write(), and .close().
#I had no difficulty completing this task.
# [] create The Weather
#importing the web address and opening the file. I then read the file from the beginning and split at every comma and print it and close the file
!curl https://raw.githubusercontent.com/MicrosoftLearning/intropython/master/world_temp_mean.csv -o mean_temp.txt
mean_file = open("mean_temp.txt","a+")
mean_file.write("Rio de Janeiro,Brazil,30.0,18.0")
mean_file.seek(0)
headings = mean_file.readline().split(",")
print(headings,"\n")
city_temp = mean_file.readline()
while city_temp:
temp_list = city_temp.split(',')
print(headings[2] + " for " + temp_list[0] + " is " + temp_list[2] + " Celsius")
city_temp = mean_file.readline()
mean_file.close()
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 222 100 222 0 0 2018 0 --:--:-- --:--:-- --:--:-- 2018
['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
month ave: highest high for Rio de Janeiro is 30.0 Celsius