Advertisement
Guest User

Untitled

a guest
Jul 28th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.51 KB | None | 0 0
  1. TICKET_PRICE = 10
  2. tickets_remaining = 100
  3. service_charge = 2
  4.  
  5. def tickets():
  6.   global tickets_requested
  7.   try:
  8.     tickets_requested = int(input("Hello {}, I'm glad your interested in our show!  How many tickets would you like to reserve?   ".format(name)))
  9.   except ValueError:
  10.     print("please use Numerics")
  11.   else:  
  12.     if tickets_requested == 0:
  13.       print("Congratulations! {}, it seems you already have all the tickets you need.  Have a nice day!".format(name))    
  14.     elif tickets_requested <= tickets_remaining:
  15.       global total
  16.       total = (tickets_requested * TICKET_PRICE) + service_charge
  17.       confirm()
  18.     else:
  19.       print("I'm sorry {}, we don't have that many tickets on hand, lets go back & try again!".format(name))
  20.       tickets()
  21.    
  22. def confirm():
  23.   confirmation = input("Your total will be ${}.00,counting a ${}.00 service charge would you like to proceed?   ".format(total, service_charge))
  24.   if confirmation == "Yes" or confirmation == "yes" or confirmation == "Y" or confirmation == "y":
  25.     print("Thank you {}, for purchasing tickets to our show".format(name))
  26.   else:
  27.     print("I'm sorry {}, we must have made a mistake, let's try this again".format(name))
  28.  
  29. while tickets_remaining:
  30.     print("There are {} tickets remaining".format(tickets_remaining))
  31.     name = input("Who's name shall this ticket be under?   ")
  32.     tickets()
  33.     tickets_remaining -= tickets_requested
  34. print("I'm sorry but all tickets have been purchased, we hope you will see our other showings!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement