Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- full_price = 0
- child_price = 0
- adult_price = 0
- # Price of a Child
- priceChildInt = False
- priceChild = 0
- while not priceChildInt:
- try:
- priceChild = float(input("Child Price: "))
- priceChildInt = True
- except ValueError:
- print("That is not a Integer")
- priceRailcardChildInt = False
- priceRailcardChild = 0
- while not priceRailcardChildInt:
- try:
- priceRailcardChild = float(input("RailChild Price: "))
- priceRailcardChildInt = True
- except ValueError:
- print("That is not a Integer")
- priceAdultInt = False
- priceAdult = 0
- while not priceAdultInt:
- try:
- priceAdult = float(input("Adult Price: "))
- priceAdultInt = True
- except ValueError:
- print("That is not a Integer")
- priceTicket = 0
- priceTicketInt = False
- while not priceTicketInt:
- try:
- priceTicket = int(input("Ticket Price: "))
- priceTicketInt = True
- except ValueError:
- print("That is not a Integer")
- adults = 0
- childern = 0
- adultsInt = False
- while not adultsInt:
- try:
- adults = int(input("Adults: "))
- adultsInt = True
- except ValueError:
- print("That is not a Integer")
- childernInt = False
- while not childernInt:
- try:
- childern = int(input("Childern: "))
- childernInt = True
- except ValueError:
- print("That is not a Integer")
- # Train Tickets
- tmp_adults = adults
- tmp_childern = childern
- if adults >= 1 and childern >= 4:
- tmp_childern -= 4
- tmp_adults -= 1
- child_price += priceRailcardChild * 4
- adult_price += priceAdult
- # if tmp_adults < 0: -Incorrect, Adds Railcard Adult, not norm adult - Fix
- # adult_price += adults * priceAdult
- if tmp_childern >= 0:
- child_price += tmp_childern * priceChild
- print("--------------------")
- print("Train Tickets:")
- print("Child: " + str(child_price/childern))
- print("Adult: " + str(adult_price/adults))
- print("Total Childern: " + str(child_price))
- print("Total Adults: " + str(adult_price))
- # Insomnia Tickets
- adult_ticket_price = priceTicket * adults
- child_ticket_price = priceTicket * childern
- adult_price += adult_ticket_price
- child_price += child_ticket_price
- # Printing Final Values
- print("--------------------")
- print("Insomnia Tickets:")
- print("Adult Tickets: "+str(adult_ticket_price))
- print("Child Tickets: "+str(child_ticket_price))
- print("--------------------")
- print("Final Adult Price: " + str(adult_price))
- print("Final Child Price: " + str(child_price))
- print("--------------------")
- print("One Child: " + str(round(child_price/childern, 2)))
- print("One Adult: " + str(round(adult_price/adults, 2)))
Add Comment
Please, Sign In to add comment