Advertisement
vieirak

Final Project

Jan 16th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.40 KB | None | 0 0
  1. #Kevin and Vieri
  2. import math
  3. from random import choice  # Random is for the transaction code in the generator. Kevin
  4. from string import ascii_uppercase # ascii_uppercase is for the transaction code for the letters and the string puts it in the random order. Kevin
  5. from string import digits # digits pulls out random numbers for the generator for the transaction code and the string puts it in the random order. Kevin
  6. print "-"*30
  7. print "\x1b[1m Hello, welcome to SkyNet!"
  8. print "\033[0m-"*30
  9. money = 1000
  10. shipping = 10
  11. 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']
  12. admin_username = 'futhead'
  13. admin_password = 'cake'  
  14. enter = raw_input("Before I let you in , we need authorization. Enter the Admin name.\n>")
  15. if enter in admin_username:
  16.     enter2 = raw_input("What is the Password?\n>")
  17.     print enter2
  18.     if enter2 in admin_password:
  19.       print "You're in!"
  20. else:
  21.   print "INTERLOPER! Securtiy system activated, you have 10 seconds before decimation!"
  22.   exit()
  23. def again():
  24.   global money
  25.   print "You have $%d left" %money
  26.   if money == 0:
  27.     print "You broke af."
  28.     print "Good-day"
  29.   else:
  30.     purchase()
  31.    
  32. def purchase(): # This is a new function the starts for the purchasing process. Vieri
  33.       stay = raw_input("Welcome, would you like to exit or browse?\n>")
  34.       print stay
  35.       if stay == "browse":
  36.         browse = raw_input("Would you like to buy something?(yes/no)\n>")
  37.         print browse
  38.         if browse=="yes":
  39.           print parts
  40.           buy = raw_input("What would you like to buy, we have two of everything.\n>")
  41.           print buy
  42.           global money
  43.           while money > 20: #once you reach below 20 dollars you can't buy anything
  44.             if buy=="Razer Keyboard": # i used the same base of this for each item changing prices and names where needed
  45.               print "Purchase Successful!"
  46.               print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  47.               money=money-((130+9.1) + shipping)
  48.               print "You have %s dollars left." %money
  49.               print " "
  50.               again()
  51.          
  52.             elif buy=="Razer Mouse":
  53.               print "Purchase Successful!"
  54.               print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  55.               money=money-((20+1.4) + shipping)
  56.               print "You have %s dollars left." %money
  57.               print " "
  58.               again()
  59.  
  60.             elif buy=="ASUS Monitor":
  61.               print "Purchase Successful!"
  62.               print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  63.               money=money-((400+28) + shipping)
  64.               print "You have %s dollars left." %money
  65.               print " "
  66.               again()
  67.  
  68.             elif buy=="ASUS Motherboard":
  69.               print "Purchase Successful!"
  70.               print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  71.               money=money-((200+14) + shipping)
  72.               print "You have %s dollars left." %money
  73.               print " "
  74.               again()
  75.  
  76.             elif buy=="Intel CPU":
  77.               print "Purchase Successful!"
  78.               print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  79.               money=money-((250+17.5) + shipping)
  80.               print "You have %s dollars left." %money
  81.               print " "
  82.               again()
  83.  
  84.             elif buy=="ASUS Graphics Card":
  85.               print "Purchase Successful!"
  86.               print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  87.               money=money-((400+28) + shipping)
  88.               print "You have %s dollars left." %money
  89.               print " "
  90.               again()
  91.  
  92.             elif buy=="CISCO System Fan":
  93.               print "Purchase Successful!"
  94.               print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  95.               money=money-((16+1.12) + shipping)
  96.               print "You have %s dollars left." %money
  97.               print " "
  98.               again()
  99.            
  100.             elif buy=="Thermaltake Computer Case":
  101.               print "Purchase Successful!"
  102.               print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  103.               money=money-((150+10.5) + shipping)
  104.               print "You have %s dollars left." %money
  105.               print " "
  106.               again()
  107.  
  108.             elif buy=="Seagate Hard Drive":
  109.               print "Purchase Successful!"
  110.               print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  111.               money=money-((100+7) + shipping)
  112.               print "You have %s dollars left." %money
  113.               print " "
  114.               again()
  115.      
  116.             elif buy=="Windows 10 Operating system":
  117.               print "Purchase Successful!"
  118.               print (''.join(choice(ascii_uppercase + digits) for i in range(9)))
  119.               money=money-((100+7) + shipping)
  120.               print "You have %s dollars left." %money
  121.               print " "
  122.               again()
  123.         elif browse == "no":
  124.           exit()
  125.       if stay == "leave":
  126.         print "Good day!"
  127.         exit()
  128. purchase() #I had lots of functions which broke the program, so i took them all and combined them into one which is why there's only one.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement