Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Greg Nacheff & Dan Kamel - 1/16/16
- import random #important because it gives a unique random ID
- a = random.choice("ABCD")*3 ##ID number
- b = random.choice("FGHJKLA")*2
- c = random.choice("123456789")*2
- d = random.choice("ZXCIOPRTG")*2
- def shop(bal): #Greg
- print "These are the remaining items we have."
- items = ["Keyboard","Mouse","Monitor","Motherboard","Computer","Graphics Card","System Fans","Computer Case","Hard Drive","Operating System"]
- itemsdict = {"Keyboard":20
- ,"Mouse": 15
- ,"Monitor": 80
- ,"Motherboard": 150
- ,"Computer":500
- ,"Graphics Card": 50
- ,"System Fans": 30
- ,"Computer Case": 30
- ,"Hard Drive" : 100
- ,"Operating System": 120} #List and values for parts
- itemnum = 1 #User can type a number 1-10 and tells them how much it costs and the money subtracted from their account.
- for thing in items: #**Very important
- print itemnum
- print thing
- itemnum = itemnum + 1
- item = raw_input("What do you want?")
- item = int(item)
- currentitem = items[item-1]
- if bal > itemsdict[currentitem]:
- print "That will cost:"
- print itemsdict[currentitem]
- bal -= itemsdict[currentitem]
- print "You now have $%d left in your balance:" %bal
- print a + b + c + d , "is your transaction ID number"
- return bal
- else: #Dan
- print "You dont have enough money to buy this."
- return bal
- #Greg: Starts the program, allows user to type in password
- print "Hi, Welcome to Amazon Prime! Everything is free 2 shipping! Sign in to your account."
- print "----------------------------------------------"
- print "Username"
- username = raw_input(">")
- print "----------------------------------------------"
- if username == "ADMIN":
- print "Password"
- password = raw_input(">")
- while password != "admin":
- print "Wrong password, try again"
- password = raw_input(">")
- #Greg and Dan: When user types in admin, they are signed in w/ $1K
- print "Thanks for logging in! Your account balance is $1000!" #Logs the user into an account
- print "----------------------------------------------"
- print "What would you like to do?"
- print "1) Browse Inventory"
- print "2) Leave"
- choice = raw_input(">")
- if choice == "1":
- print a + b + c + d , "Is your transaction ID number."
- shopping = True
- balance = 1000 #Numbers and functions to buy games #Greg
- while shopping: #Dan: While loop --> balance
- balance = shop(balance)
- yn = True
- while yn:
- print "Would you like to continue shopping? Y or N" #Gives user option to continue shopping w/ loop
- cont = raw_input(">")
- if cont == "N":
- shopping = False
- print "Thanks for your order! Have a nice day!"
- yn = False
- elif cont == "Y":
- yn = False
- else:
- print "Please type Y or N" #Loop allows for program to continue
- elif choice == "2":
- print "Have a nice day!"
- #End of Program!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement