break and continue | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

break and 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 ### It’s been a week, I don’t get it????

21st Feb 2022, 4:04 PM
Nathanael
5 Answers
+ 1
Nathanael So within 1 week what you have written, can you show?
21st Feb 2022, 4:38 PM
A͢J
A͢J - avatar
21st Feb 2022, 4:53 PM
Nathanael
0
So my plan was to take in some data and make a list from that and then loop through the list and and add 100$ for every age but jump when age is < 3.
21st Feb 2022, 4:57 PM
Nathanael
0
I have sent you link, but here is one too, https://sololearn.com/coach/1759/?ref=app
21st Feb 2022, 5:03 PM
Nathanael
0
total = 0 #your code goes here in_put = input("Input your age; ").split() for age in in_put: total += 100 if age < 3: continue print(total)
21st Feb 2022, 8:20 PM
Nathanael