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.
This is all in python
the first picture is the output of the first
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.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps