Question
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started