Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TICKET_PRICE = 10
- tickets_remaining = 100
- service_charge = 2
- def tickets():
- global tickets_requested
- try:
- tickets_requested = int(input("Hello {}, I'm glad your interested in our show! How many tickets would you like to reserve? ".format(name)))
- except ValueError:
- print("please use Numerics")
- else:
- if tickets_requested == 0:
- print("Congratulations! {}, it seems you already have all the tickets you need. Have a nice day!".format(name))
- elif tickets_requested <= tickets_remaining:
- global total
- total = (tickets_requested * TICKET_PRICE) + service_charge
- confirm()
- else:
- print("I'm sorry {}, we don't have that many tickets on hand, lets go back & try again!".format(name))
- tickets()
- def confirm():
- confirmation = input("Your total will be ${}.00,counting a ${}.00 service charge would you like to proceed? ".format(total, service_charge))
- if confirmation == "Yes" or confirmation == "yes" or confirmation == "Y" or confirmation == "y":
- print("Thank you {}, for purchasing tickets to our show".format(name))
- else:
- print("I'm sorry {}, we must have made a mistake, let's try this again".format(name))
- while tickets_remaining:
- print("There are {} tickets remaining".format(tickets_remaining))
- name = input("Who's name shall this ticket be under? ")
- tickets()
- tickets_remaining -= tickets_requested
- 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