While playing with Python I came up with a simple simulator for a supermarket where I catalog the items and their prices.
N=int(input("Number of items: ")) n1=0 name1=str(input("Product: ")) price1=float(input("Price: ")) price1="%.2f $" % (price1) n=n1+1 item1=f"{n}.{name1}---{price1}" table=[] table.append(item1) while n<N: name=str(input("Product: ")) price=float(input("Price: ")) price="%.2f $" % (price) n=n+1 item=f"{n}.{name}---{price}" table.append(item) for x in range(len(table)): print (table[x]) For the input
Number of items: 3 Product: Milk Price: 5 Product: Water Price: 1 Product: Apple Price: 3.49 For the output
1.Milk---5.00 $ 2.Water---1.00 $ 3.Apple---3.49 $ I want to get the print output exported as a txt. file to use it in another project.