0

Ticket price | python for beginners

You are making a ticketing system. The price of a single ticket is $100. For children under 3 years of age, the ticket is free. Your program needs to take the ages of 5 passengers as input and output the total price for their tickets. Note:There is one child under 3 among the passengers, so the total price of 5 tickets is $400 This is my question

15th Feb 2022, 5:05 PM
Vinod Shenoy
6 Respuestas
+ 2
# variable to hold the total initialize it with 0 total = 0 # for loop iterate 5 times to take ages for i in range(5): age = int(input()) # check if age greater than or equal 3 (if 3 inclusive) # then increase total by 100$ if age >= 3: total += 100 # print total print(total)
15th Feb 2022, 5:58 PM
Mohamed
Mohamed - avatar
+ 2
Hey M O H A M E D, I don't think you should give away the answer. A much better way of teaching is to explain the steps, but do not give away the answer 🙂
15th Feb 2022, 11:44 PM
Gurseerit Singh Chahal ✓
Gurseerit Singh Chahal ✓ - avatar
0
Hey guys i need answer
8th Feb 2023, 4:46 PM
ATHARVA
ATHARVA - avatar
0
Of ticket price question it showing that efo reading problem i need help
8th Feb 2023, 4:47 PM
ATHARVA
ATHARVA - avatar
0
Pls give answer
8th Feb 2023, 4:47 PM
ATHARVA
ATHARVA - avatar