2.3. Ticket Price ¶
A group of people wants to make a little trip to another city by train
and also calculate the total ticket price because ticket prices are
different with respect to age. In this question, you will write a
program that reads the ages of the each person in the group and
calculate the total ticket price and then print it. Please note that
the people count is unknown and input includes all the ages in one
line seperated by one space.
Ticket prices with respect to ages are as follows:
- 0-10 \(\rightarrow\) 30
- 11-25 \(\rightarrow\) 60
- 26-60 \(\rightarrow\) 90
- 60< \(\rightarrow\) 50
Sample I/O:
Input:
[35, 35, 5, 15]
Output:
270
Input:
23 25
Output:
120
Input:
[57, 63, 1, 2, 4, 6, 8, 10, 15]
Output:
380
Input:
[33]
Output:
90
ages = eval(input())
total_price = 0
for age in ages:
if 0 <= age <= 10:
total_price += 30
elif 11 <= age <= 25:
total_price += 60
elif 26 <= age <= 60:
total_price += 90
elif 60 < age:
total_price += 50
print(total_price)