Computers and Technology

The Weather Create a program that:
Imports and opens a file
Appends additional data to a file
Reads from the file to displays each city name and month average high temperature in Celsius

Output: The output should resemble the following

City of Beijing month ave: highest high is 30.9 Celsius
City of Cairo month ave: highest high is 34.7 Celsius
City of London month ave: highest high is 23.5 Celsius
City of Nairobi month ave: highest high is 26.3 Celsius
City of New York City month ave: highest high is 28.9 Celsius
City of Sydney month ave: highest high is 26.5 Celsius
City of Tokyo month ave: highest high is 30.8 Celsius
City of Rio De Janeiro month ave: highest high is 30.0 Celsius

All of the above text output is generated from the file. Only these strings are hard coded:

"is"
"of"
"Celsius"

Import the file into the Jupyter Notebook environment
Use !curl to download https://raw. githubusercontent. com/MicrosoftLearning/intropython/m aster/world_temp_mean. csv as mean_temp. txt
# [ ] The Weather: import world_mean_team. csv as mean_temp. txt into the Jupyter notebook

Add the weather for Rio
Open the file in append plus mode ('a+')
Write a new line for Rio de Janeiro "\nRio de Janeiro, Brazil,30.0,18.0"
Grab the column headings
Use .seek() to move the pointer to the beginning of the file
Read the first line of text into a variable called: headings
Convert headings to a list using .split(',') which splits on each comma
# [ ] The Weather: open file, read/print first line, convert line to list (splitting on comma)

Read the remaining lines from the file using a while loop
Assign remaining lines to a city_temp variable
Convert the city_temp to a list using .split(',') for each .readline() in the loop
Print each city & the highest monthly average temperature
Close mean_temps
>Tips & Hints:

Print headings to determine indexes to use for the final output (what is in headings[0], [1], [2]..?)
The city_temp data follows the order of the headings (city_temp[0] is described by headings[0])
The output should look like: "month ave: highest high" for Beijing is 30.9 Celsius
Convert city_temp to lists with .split(',')
# [ ] The Weather: use while loop to print city and highest monthly average temp in celsius

# [] create The Weather

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:20, destinyleisantos
The kurt vonnegut commencement speech, the neiman-marcus chocolate chip cookie recipe, and the get-well emails to the dying boy are examples of select one: a. social engineering b. hoax emails c. email viruses d. worms
Answers: 1
image
Computers and Technology, 23.06.2019 01:30, shelley3135
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
image
Computers and Technology, 23.06.2019 02:30, jaueuxsn
Which component acts as a platform on which application software runs
Answers: 2
image
Computers and Technology, 23.06.2019 18:50, ana7496
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
Do you know the correct answer?
The Weather Create a program that:
Imports and opens a file
Appends additional data to...

Questions in other subjects:

Konu
SAT, 09.12.2021 02:30
Konu
Mathematics, 09.12.2021 02:30
Konu
Mathematics, 09.12.2021 02:30