Guest User

Untitled

a guest
Sep 28th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.65 KB | None | 0 0
  1. full_price = 0
  2. child_price = 0
  3. adult_price = 0
  4.  
  5. # Price of a Child
  6. priceChildInt = False
  7. priceChild = 0
  8. while not priceChildInt:
  9.     try:
  10.         priceChild = float(input("Child Price: "))
  11.         priceChildInt = True
  12.     except ValueError:
  13.         print("That is not a Integer")
  14.  
  15. priceRailcardChildInt = False
  16. priceRailcardChild = 0
  17. while not priceRailcardChildInt:
  18.     try:
  19.         priceRailcardChild = float(input("RailChild Price: "))
  20.         priceRailcardChildInt = True
  21.     except ValueError:
  22.         print("That is not a Integer")
  23.  
  24. priceAdultInt = False
  25. priceAdult = 0
  26. while not priceAdultInt:
  27.     try:
  28.         priceAdult = float(input("Adult Price: "))
  29.         priceAdultInt = True
  30.     except ValueError:
  31.         print("That is not a Integer")
  32.  
  33.  
  34. priceTicket = 0
  35. priceTicketInt = False
  36. while not priceTicketInt:
  37.     try:
  38.         priceTicket = int(input("Ticket Price: "))
  39.         priceTicketInt = True
  40.     except ValueError:
  41.         print("That is not a Integer")
  42.  
  43.  
  44. adults = 0
  45. childern = 0
  46.  
  47. adultsInt = False
  48. while not adultsInt:
  49.     try:
  50.         adults = int(input("Adults: "))
  51.         adultsInt = True
  52.     except ValueError:
  53.         print("That is not a Integer")
  54.  
  55. childernInt = False
  56. while not childernInt:
  57.     try:
  58.         childern = int(input("Childern: "))
  59.         childernInt = True
  60.     except ValueError:
  61.         print("That is not a Integer")
  62.  
  63.  
  64. # Train Tickets
  65. tmp_adults = adults
  66. tmp_childern = childern
  67. if adults >= 1 and childern >= 4:
  68.     tmp_childern -= 4
  69.     tmp_adults -= 1
  70.     child_price += priceRailcardChild * 4
  71.     adult_price += priceAdult
  72. # if tmp_adults < 0: -Incorrect, Adds Railcard Adult, not norm adult - Fix
  73. #    adult_price += adults * priceAdult
  74. if tmp_childern >= 0:
  75.     child_price += tmp_childern * priceChild
  76.  
  77. print("--------------------")
  78. print("Train Tickets:")
  79. print("Child: " + str(child_price/childern))
  80. print("Adult: " + str(adult_price/adults))
  81. print("Total Childern: " + str(child_price))
  82. print("Total Adults: " + str(adult_price))
  83.  
  84.  
  85. # Insomnia Tickets
  86. adult_ticket_price = priceTicket * adults
  87. child_ticket_price = priceTicket * childern
  88. adult_price += adult_ticket_price
  89. child_price += child_ticket_price
  90.  
  91.  
  92. # Printing Final Values
  93. print("--------------------")
  94. print("Insomnia Tickets:")
  95. print("Adult Tickets: "+str(adult_ticket_price))
  96. print("Child Tickets: "+str(child_ticket_price))
  97. print("--------------------")
  98. print("Final Adult Price: " + str(adult_price))
  99. print("Final Child Price: " + str(child_price))
  100. print("--------------------")
  101. print("One Child: " + str(round(child_price/childern, 2)))
  102. print("One Adult: " + str(round(adult_price/adults, 2)))
Add Comment
Please, Sign In to add comment