I don't understand what is the problem with this code | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

I don't understand what is the problem with this code

total = 0 i = 0 while i < 5: age = int(input()) i = i + 1 if age < 3: continue total += 100 print('total')

2nd Aug 2023, 12:30 PM
Пусть Будет Амир
5 ответов
+ 6
i am pretty sure that this is an exercice from the old *python for beginners* tutorial. the task description is: > 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 > Program needs to take the ages of 5 passengers as input and output the total price for their tickets following this, we have to fix 3 issues to make the code run properly: https://code.sololearn.com/cbM63pdkOo6f/?ref=app
2nd Aug 2023, 5:17 PM
Lothar
Lothar - avatar
+ 5
Did you indent your code properly
2nd Aug 2023, 12:41 PM
Aweneg Rooney
Aweneg Rooney - avatar
+ 5
Пусть Будет Амир What is the code supposed to do?
2nd Aug 2023, 12:44 PM
Junior
Junior - avatar
+ 5
When printing a variable in python you don't need quotation marks that is it was supposed to be print(total) not print ('total')
2nd Aug 2023, 12:44 PM
Aweneg Rooney
Aweneg Rooney - avatar
0
fixed code :) total = 0 i = 0 while i < 5: age = int(input()) i = i + 1 if age < 3: continue total += 100 print(total)
2nd Aug 2023, 9:33 PM
Defying Gravity
Defying Gravity - avatar