vieirak

Final Project

Jan 16th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.46 KB | None | 0 0
  1. #Kevin Vieira and Vieri Arriaga
  2. import math
  3. from random import choice  # Random is for the transaction code. Kevin
  4. from string import ascii_uppercase # ascii_uppercase is for the transaction code for the letters. Kevin
  5. from string import digits # digits pulls out random numbers for the generator for the transaction code. Kevin
  6. print "-"*30
  7. print "\x1b[1m Hello, welcome to SkyNet!"
  8. print "\033[0m-"*30
  9. money = 1000
  10.  
  11.  
  12. parts = ['Razer Keyboard', 'Razer Mouse', 'ASUS Monitor', 'ASUS Motherboard', 'Intel CPU', 'ASUS Graphic Card', 'Cisco System Fan', 'Termaltake Computer Case', 'Seagate Hard Drive', 'Windows 10 Operating System']
  13. admin_username = 'futhead'
  14. admin_password = 'cake'
  15.  
  16. def purchase():
  17.   global money
  18.   print "What would you like to buy?"
  19.   print parts
  20.   stuff=raw_input()
  21.  
  22.   while money > 130:
  23.     if stuff=="Razer Keyboard":
  24.       print "Purchase Successful!"
  25.       print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  26.       money=money-130
  27.       print "You have %s dollars left." %money
  28.       print " "
  29.       again()
  30.  
  31.   while money > 20:
  32.     if stuff=="Razer Mouse":
  33.       print "Purchase Successful!"
  34.       print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  35.       money=money-20
  36.       print "You have %s dollars left." %money
  37.       print " "
  38.       again()
  39.    
  40.   while money > 400:
  41.     if stuff=="ASUS Monitor":
  42.       print "Purchase Successful!"
  43.       print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  44.       money=money-400
  45.       print "You have %s dollars left." %money
  46.       print " "
  47.       again()
  48.  
  49.   while money > 200:
  50.     if stuff=="ASUS Motherboard":
  51.       print "Purchase Successful!"
  52.       print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  53.       money=money-200
  54.       print "You have %s dollars left." %money
  55.       print " "
  56.       again()
  57.  
  58.   while money > 250:
  59.     if stuff=="Intel CPU":
  60.       print "Purchase Successful!"
  61.       print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  62.       money=money-250
  63.       print "You have %s dollars left." %money
  64.       print " "
  65.       again()
  66.  
  67.   while money > 400:
  68.     if stuff=="ASUS Graphics Card":
  69.       print "Purchase Successful!"
  70.       print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  71.       money=money-400
  72.       print "You have %s dollars left." %money
  73.       print " "
  74.       again()
  75.  
  76.   while money > 160:
  77.     if stuff=="CISCO System Fan":
  78.       print "Purchase Successful!"
  79.       print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  80.       money=money-160
  81.       print "You have %s dollars left." %money
  82.       print " "
  83.       again()
  84.  
  85.   while money > 150:
  86.     if stuff=="Thermaltake Computer Case":
  87.       print "Purchase Successful!"
  88.       print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  89.       money=money-150
  90.       print "You have %s dollars left." %money
  91.       print " "
  92.       again()
  93.  
  94.   while money > 100:
  95.     if stuff=="Seagate Hard Drive":
  96.       print "Purchase Successful!"
  97.       print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  98.       money=money-100
  99.       print "You have %s dollars left." %money
  100.       print " "
  101.       again()
  102.  
  103.   while money > 100:
  104.     if stuff=="Windows 10 Operating system":
  105.       print "Purchase Successful!"
  106.       print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  107.       money=money-100
  108.       print "You have %s dollars left." %money
  109.       print " "
  110.       again()
  111.  
  112.  
  113. def start():  # This is the start of the function for the welcome part. Vieri
  114.   enter = raw_input("Before I let you in , we need authorization. Enter the Admin name.\n>")
  115.   if enter in admin_username:
  116.     enter2 = raw_input("What is the Password?\n>")
  117.     print enter2
  118.     if enter2 in admin_password:
  119.       print "You're in!"
  120.       stay = raw_input("Welcome, would you like to exit or browse? \n>")
  121.       print stay
  122.       if stay == "browse":
  123.         print parts
  124.         print raw_input("We have an unlimited supply of everything. What would you like to buy?\n>")
  125.        
  126.       if stay == "leave":
  127.         print "Good day!"
  128.         exit()
  129.   else:
  130.     print "INTERLOPER! Securtiy system activated, you have 10 seconds before decimation!"
  131.     exit()
  132.  
  133.  
  134. def again():
  135.   global money
  136.   print "You have $%d left" %money
  137.   if money == 0:
  138.     print "You broke af."
  139.     print "Good-day"
  140.   else:
  141.     start()
  142.   print " "
  143.   buy=raw_input()
  144.   while money > 0:
  145.       purchase()
Add Comment
Please, Sign In to add comment