Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello. Please check my code. Im getting an error message line 23 I inventoryValue . append(lineItems... TypeError::cant multiply sequence by non-int of type float. .

Hello. Please check my code. Im getting an error message line 23 I inventoryValue . append(lineItems... TypeError::cant multiply sequence by non-int of type float. . Ive monkeyd around with and hit wall. Can you provide suggestions why this isnt running. Im running Python version 3.6. image text in transcribed
File Edit Format Run Options Window Help # Instructors folder CSV file called Inventory, tt # Read contents of file and out put a file called InventoryByxxx.txt. # File will contain lines displaying the following: # COUNT of items, ITEM CODE, GENERAL name, SPECIFIC name, SIZE, TYPE, PRICE per. # Example of line: 228, SEA-13189, Pepper, Florida, 8 oz., Seasoning, 8.75 Display as Florida Pepper space> value of inventory. # where the name will be dLSplayed with the SPECIFIC portion followed by the # GENERAL portion of name seperated by one space and amount will appear with t two decimal digits with commas in neatly arranged (decimals alligned, columnar # display output file. Add write one additional line to the file which will be TOTAL INVENTORY which is total of the value of all items. Allign all in columns, commas as necessary, decimal places aligned. specificName- [] #Lists that hold data generalName inventoryValue- readFile -open(Inventory.txt,open file tor processing for line in readFile.readlines(): #iterating over each line lneltens-line.split(',') #splitting on comma and space specificName.append(line 1 tens [3]) #addinf respective parall lists generalName.append (1ineItems (2]) inventoryValue.append (inelcems to1loat (ineItems (6])) #writing results t output file InventoryByxxx open('Inventory.txt',w for i n range (0,len (specficName)) : #iterating over list nventoryByxxx.write (specifickame[1]+..+generalsamei))twriting InventoryByxxx.write( total!nvvalue +-invvalue [1] #accumulator resulta yByxxx.write("Total Inventory\t') #writing total to inventory value Inventor InventoryByxxx.write:6n.format (totalInvWalue), InventoryByxxx.close) Ln: 2 Col: 0 DOLL

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions