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
5 Antworten
+ 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)
+ 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 🙂
0
Hey guys i need answer
0
Of ticket price question it showing that efo reading problem i need help
0
Pls give answer