[solved] – Question 97227
Copy and paste the following code into the Solve tab. It will take data from input and put it into a file. Use the filepath variable to open the file and solve this problem.
import os
# This program has read/write access to the WORKSPACE directory
filepath = os.path.join( os.environ[‘WORKSPACE’], ‘NewYorkTemps.txt’ )
# The testing system will let this program know how many lines to expect
num_of_lines = int( input() )
# Copy input into the file. Do not modify!
with open( filepath, ‘w’ ) as file:
for _ in range( num_of_lines ):
file.write( input() + ‘n’ )
# Write your program below
file = open(filepath, ‘r’)
Write a program to find the average of the numbers stored in NewYorkTemps.txt. Be sure your output uses floating point numbers (i.e. numbers with decimals).
Expert Answer
OR

