This is all in python the first picture is the output of the first program & the second is for the second program Write program that creates a text file to store the inventory of a retail store. Acquire the item name, quantity in stock, and unit price of each item in the inventory from user keyboard input. Use a while loop because the size of the inventory is unknown. Each datum should be on its own line in the file. here is my code that is for the above question file = open ('inventory.txt', 'w') while True: item_name=input('Enter the item name or Enter to quit '); if (item_name ==""): break quantity_of_item=float(input('Enter the quantity of this item ')) unit_price=float(input('Enter the unit price of this item ')) file.write(item_name+" "+str(unit_price)+""+str(quantity_of_item)+"") file.close () print('File was created and closed')     program6_2.py This program reads the text file created in the program above and displays its data. After printing the details for each item, the program should report the item name and inventory value of the most valuable inventory item.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This is all in python

the first picture is the output of the first program & the second is for the second program

Write program that creates a text file to store the inventory of a retail store. Acquire the item namequantity in stock, and unit price of each item in the inventory from user keyboard input. Use a while loop because the size of the inventory is unknown. Each datum should be on its own line in the file.

here is my code that is for the above question

file = open ('inventory.txt', 'w')
while True:
item_name=input('Enter the item name or Enter to quit ');

if (item_name ==""):
break

quantity_of_item=float(input('Enter the quantity of this item '))
unit_price=float(input('Enter the unit price of this item '))

file.write(item_name+" "+str(unit_price)+""+str(quantity_of_item)+"")


file.close ()

print('File was created and closed')

 

 

program6_2.py
This program reads the text file created in the program above and displays its data. After printing the details for each item, the program should report the item name and inventory value of the most valuable inventory item.

Enter item name or Enter to quit hats
Enter the quantity of this item 12
Enter the unit price of this item 19.99
Enter item name or Enter to quit shoes
Enter the quantity of this item 6
Enter the unit price of this item 49.95
Enter item name or Enter to quit shorts
Enter the quantity of this item 18
Enter the unit price of this item 24.95
Enter item name or Enter to quit tops
Enter the quantity of this item 10
Enter the unit price of this item 17.99
Enter item name or Enter to quit sandals
Enter the quantity of this item 8
Enter the unit price of this item 29.99
Enter item name or Enter to quit
File was created and closed
Transcribed Image Text:Enter item name or Enter to quit hats Enter the quantity of this item 12 Enter the unit price of this item 19.99 Enter item name or Enter to quit shoes Enter the quantity of this item 6 Enter the unit price of this item 49.95 Enter item name or Enter to quit shorts Enter the quantity of this item 18 Enter the unit price of this item 24.95 Enter item name or Enter to quit tops Enter the quantity of this item 10 Enter the unit price of this item 17.99 Enter item name or Enter to quit sandals Enter the quantity of this item 8 Enter the unit price of this item 29.99 Enter item name or Enter to quit File was created and closed
12 hats @ $19.99, value $239.88
6 shoes @ $49.95, value $299.70
18 shorts @ $24.95, value $449.10
10 tops @ $17.99, value $179.90
8 sandals @ $29.99, value $239.92
Total inventory value is $1,408.50
Highest value item is shorts @ $449.10
Transcribed Image Text:12 hats @ $19.99, value $239.88 6 shoes @ $49.95, value $299.70 18 shorts @ $24.95, value $449.10 10 tops @ $17.99, value $179.90 8 sandals @ $29.99, value $239.92 Total inventory value is $1,408.50 Highest value item is shorts @ $449.10
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Header Files
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education