Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Ticket_order():
- ticket_prices = {
- "Child": 5,
- "Kid": 10,
- "Teen": 15,
- "Adult": 20
- }
- try:
- ticket_numb = int(input("how many ticket would you like to purchase?\n : "))
- except ValueError:
- Ticket_order()
- i = 0
- total = []
- while i < ticket_numb:
- ticket_type = str(input("Enter the ticket type: Child, Kid, Teen, Adult\n : ")).capitalize()
- try:
- print(f"{ticket_type} is " + str(ticket_prices[ticket_type])+"$") if ticket_type in ticket_prices else print("None")
- i += 1
- total.append(ticket_prices[ticket_type])
- except KeyError:
- print(f"Error! {KeyError} ")
- Ticket_order()
- print(f"Your total is: {sum(total)}$")
- return mains() if input("\nTo go back press any key ") == type(str) or type(int) else print("none")
- def Movice_selection():
- film_namez = ["FILMAJÁNLATUNK MÁRA: ","filmem","filmuk","filmek","drog"]
- keys = range(5)
- Movie_dict = {
- }
- for i in keys:
- Movie_dict[i] = film_namez[i]
- print(Movie_dict)
- return mains() if input("\nTo go back press any key ") == type(str) or type(int) else print("none")
- def Ticket_prices():
- print("\n Child ticket: age 0-12: 5$\n Kid ticket: age 13-15: 10$\n Teen ticket: age 16-20 15$ \n Adult ticket: age 21 - 99 20$")
- return mains() if input("\nTo go back press any key ") == type(str) or type(int) else print("none") # <--- 'else' rész bőven nincs kész
- def mains(): # <--- main szerűség
- print("\n Welcome to the Cinema Ticket System !")
- print(" If you want to see todays movie section press: 1 \n If you want to see ticket prices press: 2 \n If you want to purchase tickets press: 3\n If you want to quit press: 4")
- try:
- option_n = int(input("Your choice : ")) # <---- szolgálata: a program ne dobja el-
- except ValueError: # magát ha a retardált user faszságot ad meg
- print("Your Choice must be in the given range !\n")
- mains()
- if option_n == 1: # <--- eldönti mit is csinál az inputra
- Movice_selection()
- elif option_n == 2:
- Ticket_prices()
- elif option_n == 3:
- Ticket_order()
- elif option_n == 4:
- print("Thanks for your time ! ")
- exit()
- else:
- if option_n > 4: # <---- out of range second hiba ellenes layer
- print("\nERROR! input was out of range ! \n")
- mains()
- mains() # <---- előhívja a main functiont ami a program alapja
- #Ticket_order()
- #Ticket_prices()
Advertisement
Add Comment
Please, Sign In to add comment