Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write code that reads and analyses prices from a text file. Firstly, you must read all of the prices from the file. Code which opens

write code that reads and analyses prices from a text file.

Firstly, you must read all of the prices from the file. Code which opens the file has been provided for you. Write code which reads from the file object prices_file, populating a list of numbers representing the prices that came from the file. Give your list variable an appropriate name.

Hint: you do not need to remove the trailing newline character from each line.

b) Analysing the prices

Next, you must write code which finds the the average price of items priced at $125 or more and find the the number of items that are prices below or above average price. You are to perform these computations by aggregating your list with a loop---do not use existing functions/methods like len, min, sum, or sort. Display the computed values to two decimal places using f-strings. Refer to the last part of Topic 4 for simple examples of aggregation using a loop.

You may assume that no item is priced $9999 or more.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions

Question

=+ (c) Write out (8.56) explicitly for the case s = 2.

Answered: 1 week ago

Question

suggest a range of work sample exercises and design them

Answered: 1 week ago