Advertisement
Guest User

Untitled

a guest
Jan 15th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 16.20 KB | None | 0 0
  1. from random import choice
  2. from string import ascii_uppercase
  3. from string import digits
  4.  
  5. allowed_users=["ADMIN"]
  6. allowed_passwords=["admin"]
  7.  
  8. wallet=1000
  9. a=5
  10. b=5
  11. c=5
  12. d=5
  13. e=5
  14. f=5
  15. g=5
  16. h=5
  17. i=5
  18. j=5
  19. z=0
  20.  
  21. def create():
  22.     global allowed_users
  23.     global allowed_passwords
  24.     m=raw_input("Enter new Username: ")
  25.     n=raw_input("Enter new Password: ")
  26.     allowed_users.append(m)
  27.     allowed_passwords.append(n) # Function to create new account
  28.  
  29. def login():
  30.     global allowed_users
  31.     global allowed_passwords
  32.     l=0
  33.    
  34.     print "Please enter your Username and Password."
  35.     while l==0:
  36.         s=raw_input("\nUsername: ")
  37.         d=raw_input("Password: ")
  38.    
  39.         if s in allowed_users and d in allowed_passwords:
  40.             print "Thanks you for logging in. Your account balance is $1000.\n"
  41.             l=100
  42.         else:
  43.             print "Incorrect Username and/or Password."
  44.             continue # Logs in to store
  45.    
  46. while z==0:
  47.     print """
  48.    Welcome User. Select a number to begin.
  49.    
  50.    1) Create Account
  51.    2) Login
  52.    
  53.    """
  54.    
  55.     q=int(input(">"))
  56.     if q==1:
  57.         create()
  58.     elif q==2:
  59.         login()
  60.         z=z+100
  61.        
  62.     else:
  63.         print "Not an Option" # While loop for logging in
  64.  
  65.  
  66. def menu():
  67.     print """
  68.    Welcome User, to the Awesome Deluxe Computer Parts Shop. Select the Number to Begin.
  69.    \t1) Browse Selections
  70.    \t2) Leave Shop
  71.    """  # Function for Main Menu
  72.  
  73. def purchase():
  74.     global wallet
  75.     global a
  76.     global b
  77.     global c
  78.     global d
  79.     global e
  80.     global f
  81.     global g
  82.     global h
  83.     global i
  84.     global j
  85.     while wallet>0: #while loop for buying
  86.         print """
  87.    Here are the Selections we have currently. You have %d dollars left in your account.
  88.    
  89.    1) EVGA GeForce GT 740 Superclocked Single Slot 4GB DDR3 Graphics Cards 04G-P4-2744-KR (%d)
  90.    
  91.    2) Corsair Vengeance Pro 16GB 2x8GB DDR3 2400MHz PC3 19200 Desktop, Red CMY16GX3M2A2400C11R (%d)
  92.    
  93.    3) Corsair Gaming M65 RGB FPS Gaming Mouse, Aircraft-Grade Aluminum, 8200 DPI (CH-9000109-NA) (%d)
  94.    
  95.    4) Tree New Bee Cooling Pad for 15.6 - 17-Inch Laptops with Four 120mm Fans at 1200 RPM, Black (TNB-K0025) (%d)
  96.    
  97.    5) WD Blue 1TB Desktop Hard Disk Drive - 7200 RPM SATA 6 Gb/s 64MB Cache 3.5 Inch - WD10EZEX (%d)
  98.    
  99.    6) AULA LED Backlit Gaming Keyboard (3 Colorways) (%d)
  100.    
  101.    7) AMD A10-5800K APU 3.8Ghz Processor AD580KWOHJBOX (%d)
  102.    
  103.    8) NEC 55" LED 1920 x 1080 3500:1 Ultra-Narrow Bezel TileMatrix Video Wall Solution X554UNS-TMX9P (%d)
  104.    
  105.    9) Crucial Ballistix Sport 8GB Kit (4GBx2) DDR3 1600 MT/s (PC3-12800) CL9 @1.5V UDIMM 240-Pin Memory BLS2K4G3D169DS1J (%d)
  106.  
  107.    10) Nile Crocodile Lawyer's Bag (%d)
  108.    
  109.    11) I do not want to buy anything right now.
  110.  
  111.    """ %(wallet,a,b,c,d,e,f,g,h,i,j)
  112.    
  113.         p=int(input("Choose the Number to see the Selection. "))
  114.    
  115.         if p==1: # if statements for buying items
  116.             print """
  117.        EVGA GeForce GT 740 Superclocked Single Slot 4GB DDR3 Graphics Cards 04G-P4-2744-KR (%d) by EVGA
  118.        $98 (.07% tax + $11 S&H)
  119.        """
  120.             print "Are you sure you want to purchase this item for 98 dollars plus taxing and shipping costs?"
  121.        
  122.             t=raw_input(">")
  123.        
  124.             if t=="yes" or t=="Yes":
  125.                 r=int(input("How many do you want? "))
  126.                 price=98*r
  127.                 tax=price*.07
  128.                 final_price=price+tax+11
  129.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9))) #Transaction ID
  130.                 if a>0 and wallet>final_price:
  131.                     a=a-r
  132.                     wallet=wallet-final_price
  133.                     print """
  134.            Transaction ID: %s
  135.            
  136.            Total = $%d
  137.                Thanks for shopping with Us. Your new balance is $%d.
  138.            
  139.            There are %d left of this item.
  140.            
  141.            """ %(trans,final_price, wallet, a)
  142.                
  143.                 else:
  144.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  145.                
  146.             elif t=="no" or t=="No":
  147.                 print "Going Back to Menu"
  148.        
  149.         elif p==2:
  150.             print """
  151.        Corsair Vengeance Pro 16GB 2x8GB DDR3 2400MHz PC3 19200 Desktop, Red CMY16GX3M2A2400C11R
  152.        $85 (.07% tax + $11 S&H)
  153.        """
  154.             print "Are you sure you want to purchase this item for 85 dollars plus taxing and shipping costs?"
  155.        
  156.             t=raw_input(">")
  157.        
  158.             if t=="yes" or t=="Yes":
  159.                 r=int(input("How many do you want? "))
  160.                 price=85*r
  161.                 tax=price*.07
  162.                 final_price=price+tax+11
  163.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  164.                 if b>0 and wallet>final_price:
  165.                     b=b-r
  166.                     wallet=wallet-final_price
  167.                     print """
  168.            Transaction ID: %s
  169.            
  170.            Total $%d
  171.                Thanks for shopping with Us. Your new balance is $%d.
  172.            
  173.            There are %d left of this item.
  174.            
  175.            """ %(trans,final_price, wallet, b)
  176.                
  177.                 else:
  178.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  179.                
  180.             elif t=="no" or t=="No":
  181.                 print "Going Back to Menu"
  182.        
  183.         elif p==3:
  184.             print """
  185.        Corsair Gaming M65 RGB FPS Gaming Mouse, Aircraft-Grade Aluminum, 8200 DPI (CH-9000109-NA)
  186.        $60 (.07% tax + $11 S&H)
  187.        """
  188.             print "Are you sure you want to purchase this item for 60 dollars plus taxing and shipping costs?"
  189.        
  190.             t=raw_input(">")
  191.        
  192.             if t=="yes" or t=="Yes":
  193.                 r=int(input("How many do you want? "))
  194.                 price=60*r
  195.                 tax=price*.07
  196.                 final_price=price+tax+11
  197.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  198.                 if c>0 and wallet>final_price:
  199.                     c=c-r
  200.                     wallet=wallet-final_price
  201.                     print """
  202.            Transaction ID: %s
  203.            
  204.            Total: $%d
  205.            
  206.                Thanks for shopping with Us. Your new balance is $%d.
  207.            
  208.            There are %d left of this item.
  209.            
  210.            """ %(trans,final_price, wallet, c)
  211.                
  212.                 else:
  213.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  214.                
  215.             elif t=="no" or t=="No":
  216.                 print "Going Back to Menu"
  217.                
  218.         elif p==4:
  219.             print """
  220.        Tree New Bee Cooling Pad for 15.6 - 17-Inch Laptops with Four 120mm Fans at 1200 RPM, Black (TNB-K0025)
  221.        $23 (.07% tax + $11 S&H)
  222.        """
  223.             print "Are you sure you want to purchase this item for 23 dollars plus taxing and shipping costs?"
  224.        
  225.             t=raw_input(">")
  226.        
  227.             if t=="yes" or t=="Yes":
  228.                 r=int(input("How many do you want? "))
  229.                 price=23*r
  230.                 tax=price*.07
  231.                 final_price=price+tax+11
  232.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  233.                 if d>0 and wallet>final_price:
  234.                     d=d-r
  235.                     wallet=wallet-final_price
  236.                     print """
  237.            Transaction ID: %s
  238.            
  239.            Total: $%d
  240.                Thanks for shopping with Us. Your new balance is $%d.
  241.            
  242.            There are %d left of this item.
  243.            
  244.            """ %(trans,final_price, wallet, d)
  245.                
  246.                 else:
  247.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  248.                
  249.             elif t=="no" or t=="No":
  250.                 print "Going Back to Menu"
  251.        
  252.         elif p==5:
  253.             print """
  254.        WD Blue 1TB Desktop Hard Disk Drive - 7200 RPM SATA 6 Gb/s 64MB Cache 3.5 Inch - WD10EZEX
  255.        $55 (.07% tax + $11 S&H)
  256.        """
  257.             print "Are you sure you want to purchase this item for 55 dollars plus taxing and shipping costs?"
  258.        
  259.             t=raw_input(">")
  260.        
  261.             if t=="yes" or t=="Yes":
  262.                 r=int(input("How many do you want? "))
  263.                 price=55*r
  264.                 tax=price*.07
  265.                 final_price=price+tax+11
  266.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  267.                 if e>0 and wallet>final_price:
  268.                     e=e-r
  269.                     wallet=wallet-final_price
  270.                     print """
  271.            Transaction ID: %s
  272.            
  273.            Total: $%d
  274.                Thanks for shopping with Us. Your new balance is $%d.
  275.            
  276.            There are %d left of this item.
  277.            
  278.            """ %(trans,final_price, wallet, e)
  279.                
  280.                 else:
  281.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  282.                
  283.             elif t=="no" or t=="No":
  284.                 print "Going Back to Menu"
  285.        
  286.         elif p==6:
  287.             print """
  288.        AULA LED Backlit Gaming Keyboard (3 Colorways)
  289.        $20 (.07% tax + $11 S&H)
  290.        """
  291.             print "Are you sure you want to purchase this item for 20 dollars plus taxing and shipping costs?"
  292.        
  293.             t=raw_input(">")
  294.        
  295.             if t=="yes" or t=="Yes":
  296.                 r=int(input("How many do you want? "))
  297.                 price=20*r
  298.                 tax=price*.07
  299.                 final_price=price+tax+11
  300.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  301.                 if f>0 and wallet>final_price:
  302.                     f=f-r
  303.                     wallet=wallet-final_price
  304.                     print """
  305.            Transaction ID: %s
  306.            
  307.            Total: $%d
  308.                Thanks for shopping with Us. Your new balance is $%d.
  309.            
  310.            There are %d left of this item.
  311.            
  312.            """ %(trans, final_price, wallet, f)
  313.                
  314.                 else:
  315.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  316.                
  317.             elif t=="no" or t=="No":
  318.                 print "Going Back to Menu"
  319.        
  320.         elif p==7:
  321.             print """
  322.        AMD A10-5800K APU 3.8Ghz Processor AD580KWOHJBOX
  323.        $125 (.07% tax + $11 S&H)
  324.        """
  325.             print "Are you sure you want to purchase this item for 125 dollars plus taxing and shipping costs?"
  326.        
  327.             t=raw_input(">")
  328.        
  329.             if t=="yes" or t=="Yes":
  330.                 r=int(input("How many do you want? "))
  331.                 price=125*r
  332.                 tax=price*.07
  333.                 final_price=price+tax+11
  334.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  335.                 if g>0 and wallet>final_price:
  336.                     g=g-r
  337.                     wallet=wallet-final_price
  338.                     print """
  339.            Transaction ID: %s
  340.            
  341.            Total: $%d
  342.                Thanks for shopping with Us. Your new balance is $%d.
  343.            
  344.            There are %d left of this item.
  345.            
  346.            """ %(trans,final_price, wallet, g)
  347.                
  348.                 else:
  349.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  350.                
  351.             elif t=="no" or t=="No":
  352.                 print "Going Back to Menu"
  353.        
  354.         elif p==8:
  355.             print """
  356.        NEC 55" LED 1920 x 1080 3500:1 Ultra-Narrow Bezel TileMatrix Video Wall Solution X554UNS-TMX9P
  357.        $915 (.07% tax + $11 S&H)
  358.        """
  359.             print "Are you sure you want to purchase this item for 915 dollars plus taxing and shipping costs?"
  360.        
  361.             t=raw_input(">")
  362.        
  363.             if t=="yes" or t=="Yes":
  364.                 r=int(input("How many do you want? "))
  365.                 price=915*r
  366.                 tax=price*.07
  367.                 final_price=price+tax+11
  368.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  369.                 if h>0 and wallet>final_price:
  370.                     h=h-r
  371.                     wallet=wallet-final_price
  372.                     print """
  373.            Transaction ID: %s
  374.            
  375.            Total: $%d
  376.                Thanks for shopping with Us. Your new balance is $%d.
  377.            
  378.            There are %d left of this item.
  379.            
  380.            """ %(trans,final_price, wallet, h)
  381.                
  382.                 else:
  383.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  384.                
  385.             elif t=="no" or t=="No":
  386.                 print "Going Back to Menu"
  387.        
  388.         elif p==9:
  389.             print """
  390.        Crucial Ballistix Sport 8GB Kit (4GBx2) DDR3 1600 MT/s (PC3-12800) CL9 @1.5V UDIMM 240-Pin Memory BLS2K4G3D169DS1J
  391.        $41 (.07% tax + $11 S&H)
  392.        """
  393.             print "Are you sure you want to purchase this item for 41 dollars plus taxing and shipping costs?"
  394.        
  395.             t=raw_input(">")
  396.        
  397.             if t=="yes" or t=="Yes":
  398.                 r=int(input("How many do you want? "))
  399.                 price=41*r
  400.                 tax=price*.07
  401.                 final_price=price+tax+11
  402.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  403.                 if i>0 and wallet>final_price:
  404.                     i=i-r
  405.                     wallet=wallet-final_price
  406.                     print """
  407.            Transaction ID: %s
  408.            
  409.            Total: $%d
  410.                Thanks for shopping with Us. Your new balance is $%d.
  411.            
  412.            There are %d left of this item.
  413.            
  414.            """ %(trans,final_price, wallet, i)
  415.                
  416.                 else:
  417.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  418.                
  419.             elif t=="no" or t=="No":
  420.                 print "Going Back to Menu"
  421.        
  422.         elif p==10:
  423.             print """
  424.        Nile Crocodile Lawyer's Bag
  425.        $900 (.07% tax + $11 S&H)
  426.        """
  427.             print "Are you sure you want to purchase this item for 900 dollars plus taxing and shipping costs?"
  428.        
  429.             t=raw_input(">")
  430.        
  431.             if t=="yes" or t=="Yes":
  432.                 r=int(input("How many do you want? "))
  433.                 price=900*r
  434.                 tax=price*.07
  435.                 final_price=price+tax+11
  436.                 trans=(''.join(choice(ascii_uppercase+digits) for i in range(9)))
  437.                 if j>0 and wallet>final_price:
  438.                     j=j-r
  439.                     wallet=wallet-final_price
  440.                     print """
  441.            Transaction ID: %s
  442.            
  443.            Total: $%d
  444.                Thanks for shopping with Us. Your new balance is $%d.
  445.            
  446.            There are %d left of this item.
  447.            
  448.            """ %(trans,final_price, wallet, j)
  449.                
  450.                 else:
  451.                     print "There is no more of this item and/or You don't have enough money. Going back to home."
  452.                
  453.             elif t=="no" or t=="No":
  454.                 print "Going Back to Menu"
  455.                
  456.         elif p==11:
  457.             print "Ok then. Going back to Main Menu."
  458.             break
  459.        
  460.         else:
  461.             print "Not a number on the list." #Purchase Function
  462.  
  463. while True:
  464.     menu()
  465.     t=int(input(">"))
  466.     if t==1:
  467.         purchase()
  468.     elif t==2:
  469.         print "Exiting Shop. Thank you for visting us, and We hope to see you again!!?!"
  470.         break
  471.     else:
  472.         print "Not an option." # While loop for Main Menu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement