Skip to content

Python dictionary database #1

Description

@Msokowale
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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions