subject

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

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
question
Computers and Technology, 24.06.2019 00:30
Which boolean operator enables you to exclude a search term? a} not b} and c} or d} plus
Answers: 1
question
Computers and Technology, 24.06.2019 15:00
Universal windows platform is designed for which windows 10 version?
Answers: 1
question
Computers and Technology, 24.06.2019 17:30
List at least one thing to check for when you're checking the clarity and professionalism of a document.
Answers: 1
You know the right answer?
The Weather Create a program that:
Imports and opens a file
Appends additional data to...
Questions
question
History, 17.10.2019 04:10
Questions on the website: 13722361