Guest User

Untitled

a guest
Jan 15th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.52 KB | None | 0 0
  1. #Michael Dardour and Lorenzo Perez
  2. username = "ADMIN"
  3. password = "admin"
  4.  
  5. usernamecheck = raw_input('Enter your username')
  6. passwordcheck = raw_input('Enter your password')
  7.  
  8. if usernamecheck == username:
  9.     if passwordcheck == password:
  10.         print 'Access granted'
  11.     else:
  12.         print 'Access denied'
  13.         exit()
  14. else:
  15.     print'Access denied'
  16.     exit()
  17.    
  18. money = 1000
  19. stock = ['Keyboard', 'Mouse', 'Monitor', 'Motherboard', 'CPU', 'Graphics Card', 'System Fans','Computer Case','SSD', 'Operating Systems']
  20. prices = [160, 60, 260, 170, 340, 390, 110, 105, 160, 100]
  21. leave = 1
  22. import string
  23. import random
  24.  
  25. print " "
  26. print "*If you want to leave at any moment, write 'leave'*"
  27. print " "
  28.  
  29. while leave == 1:
  30.   print 'You have $%r' % money
  31.   x = raw_input('would you like to \n Browse \n or Leave?')
  32.   print " "
  33.   if x == 'browse':
  34.       counter = 0
  35.       print " "
  36.       print 'Your items are:'
  37.       for x in stock:
  38.           counter = counter + 1
  39.           print"%d %s : %s $" %(counter, x, prices[counter - 1])
  40.  
  41.       buy = raw_input('Would you like to buy, or cancel?')
  42.       if buy == "cancel":
  43.         pass
  44.       elif buy == 'buy':
  45.           choice = raw_input('What would you like to buy?')
  46.           choice = int(choice)
  47.           product = stock[choice - 1]
  48.           product_price = prices[choice - 1]
  49.           tax = product_price * 0.07
  50.           shipping = 5 #we can change this later
  51.           total = product_price + tax + shipping
  52.           print " "
  53.  
  54.           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))
  55.           if confirmation == 'yes':
  56.               print " "
  57.               print 'You have purchased %r for %r$?' %(product, total)
  58.               print " "
  59.               if money >= total:
  60.                 money = money - total                    
  61.                 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)
  62.                 print ":"*50
  63.               else:
  64.                 print 'You dont have enough money for this item'
  65.           elif confirmation == 'no':
  66.             print 'Feel free to look around some more'
  67.             print ":"*50
  68.       elif buy == 'leave':
  69.           exit()
  70.  
  71.   elif x == 'leave':
  72.       leave = leave + 1
Add Comment
Please, Sign In to add comment