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:10
3. (5 points) describe what would be printed by the code below or what error would occur. const char* cstr = "0123456"; const char* ptr = & cstr[4]; cout < < ptr[-1] < < ptr < < endl; 1 4. (5 points) theseus has been trapped in a maze with a minotaur, which is trying to capture him. each round, theseus and the minotaur move through the maze; theseus towards the exit, and the minotaur towards theseus. theseus can move in any of the four cardinal directions, or he can wait for a round to see how the minotaur moves. write code that creates a data type to represent the possible moves that theseus could make.
Answers: 3
question
Computers and Technology, 22.06.2019 11:00
The isometric projection camera technique provides an illusion of perspective by using things like parallax scrolling to create the illusion of 3d in a 2d game
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
question
Computers and Technology, 23.06.2019 03:00
State 7 common key's for every keyboard
Answers: 1
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.04.2020 23:27
question
Mathematics, 21.04.2020 23:27
question
Mathematics, 21.04.2020 23:27
question
History, 21.04.2020 23:27
Questions on the website: 13722367