You are on page 1of 1

#Total Cost

total_cost = 0
ages = []
while True:
age_input = input("Enter the age of guest(or press to finish) ")
if not age_input:
break
try:
age = int(age_input)
ages.append(age)
except ValueError:
print("Invalid Input. Please enter a valid age")
#Ticket Price Calculation
if age <=2:
cost = 0
elif 3 <= age <= 10:
cost = 140
elif age >= 65:
cost = 200
else:
cost = 300
total_cost += cost

print(f"The total admission cost for the group is Php. {total_cost:2f}")

You might also like