python-data-structure-exercises icon indicating copy to clipboard operation
python-data-structure-exercises copied to clipboard

Python dictionary database

Open Msokowale opened this issue 2 years ago • 0 comments

st=()
print("Welcome to M-Shop")
while True:
	print("Press 1 to enter goods, 2 to get goods, 3 to see a list of goods, 0 to quit;\n")
action=input()
if action=='1':
		k=input("Enter goods' name\n")
		v=int(input("Enter the price of %s\n"))
		st[k]=v
elif action=='2':
		k=input("Enter goods'name\n")
		if not k in st :
			print("The %s is not recognised" %k)
		else:
			print("The price is %s\n" %st[v])
elif action=='3':
		print(st)
elif action=='0':
			print("welcome again")
break

Msokowale avatar Jun 01 '23 15:06 Msokowale