0

Problem with Continue in Python

Ticket calculating and below 3 years children are free and above 3 years are taking tickets $100 for each ticket this code gives an error total = 0 i = 0 while i < 5: age = int(input()) i = i+1 if age < 3: continue total +=100 print(total)

27th Dec 2022, 5:39 AM
Kundena Shravan Kumar
Kundena Shravan Kumar - avatar
4 Antworten
+ 2
Make sure to use the same amount of whitespace along your while block, so your code is properly aligned. Your last two lines seem to be misaligned.
27th Dec 2022, 5:46 AM
Tibor Santa
Tibor Santa - avatar
0
What's the correct align
27th Dec 2022, 5:50 AM
Kundena Shravan Kumar
Kundena Shravan Kumar - avatar
0
you can align the code through online code beautifier
27th Dec 2022, 7:56 AM
Syed Asheer
Syed Asheer - avatar
0
i = 0 While (i < 100): Age = int(input(": ")) If age <= 3: Print (f"puedes ir gratis") Continué Elif age > 5: Print(f"elige una edad hasta los 5 años") Continue Elif i == 100: Break Else: Print (f"pagas tu ticket a 100
quot;) i = i + 1 Print (f"fin de la venta, total {i} boletos")
27th Dec 2022, 10:29 PM
Francis Melendez
Francis Melendez - avatar