Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am VERY new to code and am struggling with this problem, I believe I have all the parts but am not aligning everything correctly

image text in transcribedimage text in transcribed

I am VERY new to code and am struggling with this problem, I believe I have all the parts but am not aligning everything correctly and can't figure out why, this was ONE of my many attempts, at one point I did get both lines to print but couldn't even remember what I had done! This prints out [6.0, 8.0, 1.0, 1.0, 1.0], the second line has an error ValueError: could not convert string to float: ','

Please note I cannot use csv module, or pandas or anything fancy as this is a very beginning course and we haven't even learned those things.

Thank you in advance for all your help!

Diameter Price 6 7 8 9 10 13 14 17.5 18 18 Read Pizza Data Read in the comma-separated values file called pizza_prices.csv. Save the diameter values to a list called diameters and the prices to a list called prices. Both lists should contain floating point values and not strings. You'll have to take into account that there is a header row in the file. You are allowed to use Python's built-in string methods such as split. # ENTER YOUR CODE HERE fileopen = open("pizza_prices.csv", "r") fileread = fileopen. readlines ( ) diameters = [] prices = [] lines = lines.split(",") for lines in fileread[1:]: diameters.append(float(lines[0])) prices.append(float(lines [1]))

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

Step: 3

blur-text-image

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

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

Why might a business invest in another companys stock?

Answered: 1 week ago

Question

Know when visuals are appropriate and how to select them

Answered: 1 week ago

Question

To find the integral of 3x/(x - 1)(x - 2)(x - 3)

Answered: 1 week ago

Question

What are Fatty acids?

Answered: 1 week ago

Question

What are Electrophoresis?

Answered: 1 week ago