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 02:50
Which of the following had the greatest influence on opening the internet to the generly public
Answers: 1
question
Computers and Technology, 22.06.2019 03:40
Hello my name is mihai and i need your : )i have to do a python project in computer science and i’m really busy with my mocks this period of time besides this i’m not good at coding so could someone pls pls pls sort me out ? i actually beg ; ))
Answers: 1
question
Computers and Technology, 22.06.2019 11:00
How does a policy manual an organization? a. it boost productivity. b. it create awareness in employees about the organization’s values. c. it employees achieve targets. d. it safeguards the organization from liabilities.
Answers: 1
question
Computers and Technology, 22.06.2019 17:40
Consider the simple 3-station assembly line illustrated below, where the 2 machines at station 1 are parallel, i.e., the product only needs to go through one of the 2 machines before proceeding to station 2.what is the throughput time of this process?
Answers: 2
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, 30.09.2019 14:10
Questions on the website: 13722367