[Solved]Python 3 Tasked Finishing Program Read Write 5 Day Forecast Data Right Program Consists Me Q37051482
IN PYTHON 3
You have been tasked with finishing a program to read and write5-day forecast data. Right now the program consists of a menu withstub functions for each option. When a user selects ‘Read File’ theprogram should prompt the user for a filename and thenprint the contents of the file. If a user selects ‘Write File’ theprogram should prompt the user for a filename, prompt the user for5 days worth high temperatures, and then write that data to thetext file. Data should be written to the text file in the followingformat:
Design your program to match the sample execution below. For clarity, user input is clearly marked. The # input from user should not be part of the program:
SPACING AND PARAGRAPHING (n) SHOULD BE IDENTICAL TO THE EXAMPLEGIVEN.
I cannot seem to get the program to run in ZyBooks.
MY CODE:
print(“Welcome to the Weather Monitor!n”)
print(“1. Read File”)
print(“2. Write File”)
print(“3. Exit”)
choice = int(input(“Choose: “))
while choice != 3:
if choice == 1:
file_name = input(“File: “)
with open(file_name, “r”) as file:
for day, data in enumerate(file.readlines()):
print(“Day {}: {}”.format(day+1, data.strip()))
elif choice == 2:
file_name = input(“File: “)
with open(file_name, “w”) as file:
for i in range(0, 5):
data = input(“Day {}: “.format(i+1))
file.write(data)
file.write(“n”)
print(“n”)
print(“1. Read File”)
print(“2. Write File”)
print(“3. Exit”)
choice = int(input(“Choose: “))
I KEEP GETTING AN ERROR FROM THE ZYBOOKSGRADER!
Welcome to the Weather Monitor 1. Read File 2. Write File Your output 3. Exit Choose: File: Day 1: Day 2: Day 3: Day 4: Day 5: Files Day 1: Day 2: y File “file-lab.ру”, data-input (“Day line 16, in <module> О. “. format ( i+1)) EOFErrorEOF when readinga line Welcome to the Weather Monitor 1. Read File 2. Write File 3. Exit Choose: File: Day 1: Day 2: Day 3: Day 4: Day 5: Read File 2. Write File Exit Expected output Choose: File: Day1:34 Day 2: 45 Day 3: 56 Day67 Day 5:78 Read File 2. Write File Exit hoose: Show transcribed image text Welcome to the Weather Monitor 1. Read File 2. Write File Your output 3. Exit Choose: File: Day 1: Day 2: Day 3: Day 4: Day 5: Files Day 1: Day 2: y File “file-lab.ру”, data-input (“Day line 16, in О. “. format ( i+1)) EOFErrorEOF when readinga line Welcome to the Weather Monitor 1. Read File 2. Write File 3. Exit Choose: File: Day 1: Day 2: Day 3: Day 4: Day 5: Read File 2. Write File Exit Expected output Choose: File: Day1:34 Day 2: 45 Day 3: 56 Day67 Day 5:78 Read File 2. Write File Exit hoose:
Expert Answer
Answer to IN PYTHON 3 You have been tasked with finishing a program to read and write 5-day forecast data. Right now the program c… . . .
OR

