Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Michael Richards and Luis Espinal
- import string
- import random
- def destination():
- print "What would you like to do?\n\t1) Browse Inventory\n\t2) Leave"
- destination=raw_input()
- if destination=="1":
- inventory()
- if destination=="2":
- leave()
- def leave():
- print "Thanks for shopping here!"
- exit()
- balance=1000
- cart=[] #represents empty cart will be adding bought items into it
- items = ['1) Razer keyboard-$160','2) Corsair mouse-$40','3) Samsung monitor-$200','4) MSI motherboard- $180','5)AMD CPU-$180','6) ASUS graphics card-$230','7) HIS system fans- $160','8) Phanteks computer case-$90','9)Seagate Hard Drive-110','10) Microsoft Windows 7 operating system-$140']
- item1=160
- item2=40
- item3=200
- item4=180
- item5=180
- item6=230
- item7=160
- item8=90
- item9=110
- item10=140
- def inventory():
- global balance
- while balance>39:
- global items
- global item1,item2,item3,item4,item5,item6,item7,item8,item9,item10
- global cart
- from random import choice #to print random code
- from string import ascii_uppercase
- print items
- print "What would you like to Buy?"
- buy=raw_input()
- if buy=="1" and balance>159:
- balance=balance-160
- print "You have bought the Razer Keyboard for $160 and your balance is now $%d"% (balance)
- print 'Your Transaction ID for this item is:'
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12))) #prints random code
- cart.append(item1) #adds item into checkoout
- items[0]='Out of Stock'
- print "Would you like to\n 1) Keep Shopping 2) Checkout and Exit"
- x=raw_input()
- if x=="1":
- inventory()
- if x=="2":
- checkout()
- if buy=="2" and balance>39:
- balance=balance-40
- print "You have bought the Corsair Mouse for $40 and your balance is now $%d"% (balance)
- print 'Your Transaction ID for this item is:'
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- cart.append(item2)
- items[1]='Out of Stock'
- print "Would you like to\n 1) Keep Shopping 2) Checkout and Exit"
- x=raw_input()
- if x=="1":
- inventory()
- if x=="2":
- checkout()
- if buy=="3" and balance>199:
- balance=balance-200
- print "You have bought the Samsung Monitor for $200 and your balance is now $%d"% (balance)
- print 'Your Transaction ID for this item is:'
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- cart.append(item3)
- items[2]='Out of Stock'
- print "Would you like to\n 1) Keep Shopping 2) Checkout and Exit"
- x=raw_input()
- if x=="1":
- inventory()
- if x=="2":
- checkout()
- if buy=="4" and balance>179:
- balance=balance-180
- print "You have bought the MSI Motherboard for $180 and your balance is now $%d"% (balance)
- print 'Your Transaction ID for this item is:'
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- cart.append(item4)
- items[3]='Out of Stock'
- print "Would you like to\n 1) Keep Shopping 2) Checkout and Exit"
- x=raw_input()
- if x=="1":
- inventory()
- if x=="2":
- checkout()
- if buy=="5" and balance>179:
- balance=balance-180
- print "You have bought the AMD CPU for $180 and your balance is now $%d"% (balance)
- print 'Your Transaction ID for this item is:'
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- cart.append(item5)
- items[4]='Out of Stock'
- print "Would you like to\n 1) Keep Shopping 2) Checkout and Exit"
- x=raw_input()
- if x=="1":
- inventory()
- if x=="2":
- checkout()
- if buy=="6" and balance>229:
- balance=balance-230
- print "You have bought the ASUS Graphics Card for $230 and your balance is now $%d"% (balance)
- print 'Your Transaction ID for this item is:'
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- cart.append(item6)
- items[5]='Out of Stock'
- print "Would you like to\n 1) Keep Shopping 2) Checkout and Exit"
- x=raw_input()
- if x=="1":
- inventory()
- if x=="2":
- checkout()
- if buy=="7" and balance>159:
- balance=balance-160
- print "You have bought the HIS System Fans for $160 and your balance is now $%d"% (balance)
- print 'Your Transaction ID for this item is:'
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- cart.append(item7)
- items[6]='Out of Stock'
- print "Would you like to\n 1) Keep Shopping 2) Checkout and Exit"
- x=raw_input()
- if x=="1":
- inventory()
- if x=="2":
- checkout()
- if buy=="8" and balance>89:
- balance=balance-90
- print "You have bought the Phanteks Computer Case for $90 and your balance is now $%d"% (balance)
- print 'Your Transaction ID for this item is:'
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- cart.append(item8)
- items[7]='Out of Stock'
- print "Would you like to\n 1) Keep Shopping 2) Checkout and Exit"
- x=raw_input()
- if x=="1":
- inventory()
- if x=="2":
- checkout()
- if buy=="9" and balance>109:
- balance=balance-110
- print "You have bought the CardSeagate Hard Drive for $110 and your balance is now $%d"% (balance)
- print 'Your Transaction ID for this item is:'
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- cart.append(item9)
- items[8]='Out of Stock'
- print "Would you like to\n 1) Keep Shopping 2) Checkout and Exit"
- x=raw_input()
- if x=="1":
- inventory()
- if x=="2":
- checkout()
- if buy=="10" and balance>139:
- balance=balance-140
- print "You have bought the Microsoft Windows 7 Operating System for $140 and your balance is now $%d"% (balance)
- print 'Your Transaction ID for this item is:'
- print(''.join(choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789') for i in range(12)))
- cart.append(item10)
- items[9]='Out of Stock'
- print "Would you like to\n 1) Keep Shopping 2) Checkout and Exit"
- x=raw_input()
- if x=="1":
- inventory()
- if x=="2":
- checkout()
- else:
- print "Sorry not enough money"
- checkout()
- def checkout():
- global cart
- global balance
- cartsum=sum(cart)
- total=(11+(cartsum*.07)+cartsum)
- tax=(cartsum*.07)
- print "The price of your order is $%d. Shipping is $11 and tax is $%d.\nYour total price with tax and shipping is $%d"% ((1000-balance), tax, total)
- balance=(balance-(cartsum*.07)-11)
- print "Your balance is now $%d"% balance
- print "Thanks for Shopping!"
- exit()
- print "Hi Welcome to the store!\nEnter your username and password to begin!"
- grantedu=['ADMIN']
- grantedp=['admin']
- username=raw_input(">")
- if username in grantedu:
- password=raw_input(">")
- if password in grantedp:
- print "Thanks for logging in!\n Your balance is $%d."% balance
- destination()
Add Comment
Please, Sign In to add comment