Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Michael Dardour and Lorenzo Perez
- username = "ADMIN"
- password = "admin"
- usernamecheck = raw_input('Enter your username')
- passwordcheck = raw_input('Enter your password')
- if usernamecheck == username:
- if passwordcheck == password:
- print 'Access granted'
- else:
- print 'Access denied'
- exit()
- else:
- print'Access denied'
- exit()
- money = 1000
- stock = ['Keyboard', 'Mouse', 'Monitor', 'Motherboard', 'CPU', 'Graphics Card', 'System Fans','Computer Case','SSD', 'Operating Systems']
- prices = [160, 60, 260, 170, 340, 390, 110, 105, 160, 100]
- leave = 1
- import string
- import random
- print " "
- print "*If you want to leave at any moment, write 'leave'*"
- print " "
- while leave == 1:
- print 'You have $%r' % money
- x = raw_input('would you like to \n Browse \n or Leave?')
- print " "
- if x == 'browse':
- counter = 0
- print " "
- print 'Your items are:'
- for x in stock:
- counter = counter + 1
- print"%d %s : %s $" %(counter, x, prices[counter - 1])
- buy = raw_input('Would you like to buy, or cancel?')
- if buy == "cancel":
- pass
- elif buy == 'buy':
- choice = raw_input('What would you like to buy?')
- choice = int(choice)
- product = stock[choice - 1]
- product_price = prices[choice - 1]
- tax = product_price * 0.07
- shipping = 5 #we can change this later
- total = product_price + tax + shipping
- print " "
- confirmation = raw_input('Are you sure you want to purchase %r for %r$ with %r$ for tax and %r$ shipping for a total of %r?\nyes or no?' %(product, product_price, tax, shipping, total))
- if confirmation == 'yes':
- print " "
- print 'You have purchased %r for %r$?' %(product, total)
- print " "
- if money >= total:
- money = money - total
- print 'Your transaction code is:', random.choice(string.letters), random.randint(0, 9), random.choice(string.letters), random.randint(0, 9), random.choice(string.letters), random.randint(0, 9), random.choice(string.letters), random.randint(0, 9)
- print ":"*50
- else:
- print 'You dont have enough money for this item'
- elif confirmation == 'no':
- print 'Feel free to look around some more'
- print ":"*50
- elif buy == 'leave':
- exit()
- elif x == 'leave':
- leave = leave + 1
Add Comment
Please, Sign In to add comment