0
Break/continue
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. Sample Input 18 24 2 5 42 Sample Output 400
3 Answers
+ 5
Mastermind Show your attempt also write clearly what problem you are facing in code?
+ 1
I make simple code to understand it but you should try by yourself firstly
input1 = int(input())
input2 = int(input())
input3 = int(input())
input4 = int(input())
input5 = int(input())
total = 0
my_list = []
my_list.append(input1)
my_list.append(input2)
my_list.append(input3)
my_list.append(input4)
my_list.append(input5)
for num in my_list:
if num > 3 :
total+= num
else:
continue
print(total)
+ 1
My gosh, I don't have any idea what my_list =[] means and what the my_list.append() function does.
I haven't done the for loop yet.
I thought it'd be simpler