subject

(Edhesive 9.7 Code Practice: Question 4): Using the prices. txt (Links to an external site.) data file find the average of the values in the file. Use the filepath variable to open the file and solve this problem. The starter code provided will take data from input and put it into a file.

Write Your Code
Use the embedded IDE below to write and test your code. The necessary .txt file is already loaded, so you can reference it when you work through the problem.
Note: If you'd like to do this in a new screen instead of within the embedded IDE, click "Open in Repl. it" in the top right-hand corner. This will open a new window and give you a unique link that will serve as your own file, so be sure to keep track of this link!
Write your code starting on line 14 in Repl. it.
When done, move to the next set of instructions that follow the embedded IDE below.

Check Your Code
First, copy and paste the following code into the "Solve" tab in the Sandbox:
import os

# This program has read/write access to the WORKSPACE directory
filepath = os. path. join( os. environ['WORKSPACE'], 'prices. 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
Then, copy and paste your program from Repl. it, starting at line 6, to the Sandbox, directly underneath the code you copied in step 1.
You're now ready to submit! Click "RUN."
You will be directed to the "History" tab where you can see whether or not your submission is "accepted."
If your code is "accepted," move to the next set of instructions. If your code is not "accepted," try debugging your code with the resource below and submitting it again.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:30
On the loan worksheet in cell c9 enter pmt function to calculate the monthly payment for the altamonte springs 2018 facilities loan. ensure that the function returns a positive value and set the reference to cells b5 and b6 as absolute references.
Answers: 2
question
Computers and Technology, 22.06.2019 11:10
Look at the far left lane in the picture. explain what the red car is doing and what it needs to do to travel safely.
Answers: 2
question
Computers and Technology, 22.06.2019 18:00
Suppose an astronomer discovers a large, spherical-shaped body orbiting the sun. the body is composed mostly of rock, and there are no other bodies sharing its orbit. what is the best way to categorize this body? a. planet b. moon c. comet d. asteroid
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
You know the right answer?
(Edhesive 9.7 Code Practice: Question 4): Using the prices. txt (Links to an external site.) data f...
Questions
question
Mathematics, 21.01.2021 20:00
question
Mathematics, 21.01.2021 20:00
question
Mathematics, 21.01.2021 20:00
question
Mathematics, 21.01.2021 20:00
question
Mathematics, 21.01.2021 20:00
question
Mathematics, 21.01.2021 20:00
question
Mathematics, 21.01.2021 20:00