While loop and Continues? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

While loop and Continues?

i have been working on a practice question forever and cannot seem to get it right. This is really frustrating me and would like to know how to do it condisidering this is just a Beginners Course in Python. Could someone help me out please. The question seems simple but.. here it is. Someone is buying planes tickets. Tickets over 3 years of age are $100 and 3 and under are $0. You can input 5 ages before its prints the total sum of ticket prices. Supposed to use continue to skip over 3 year old and younger ticket prices.

22nd Nov 2021, 4:44 PM
Eric Freeman
Eric Freeman - avatar
2 Answers
+ 2
Check the above code if and issue them reply.
22nd Nov 2021, 5:00 PM
Omkar Kamat
Omkar Kamat - avatar
+ 1
counter = 0 for i in range(5): age = int(input("Enter age :")) if(age > 3): counter += 100 print(counter)
22nd Nov 2021, 4:59 PM
Omkar Kamat
Omkar Kamat - avatar