29th May 2022, 6:58 PM
Mohammad Zakir
9 Answers
+ 4
1. why are you using a while loop? You know how many values you need 2. it's x+=1 3. x+=1 is at the wrong indent level, it needs to be inside the loop
29th May 2022, 7:13 PM
Slick
Slick - avatar
+ 3
Post the code
29th May 2022, 7:00 PM
Slick
Slick - avatar
+ 2
Mohammad Zakir For future questions: 1. Post the code by saving it as public in Code Playground, then linking it in the question description using "+" button. 2. Never post code or sentences in the tags. Just include one tag with the language name. 3. Always remember to also include in the question description what your code should do, and what it's doing instead. All this bring you closer to a solution.
29th May 2022, 7:43 PM
Emerson Prado
Emerson Prado - avatar
+ 2
Mohammad Zakir , as Slik mentioned, using a for loop is the preferred way to solve this task. but it can be done also with a while loop as your try is showing. it is just two lines of code to fix so that the code is running properly. btw: -> please use proper indentation, which should be 4 spaces per level -> the condition for calculating the price is given in the task description: "For children under 3 years old, the ticket is free" so the condition should be: ... >= 3... not ... > 3... https://code.sololearn.com/cHnut97MKkMH/?ref=app
29th May 2022, 8:08 PM
Lothar
Lothar - avatar
+ 1
https://code.sololearn.com/cRUEo1Pg5YF9/?ref=app
29th May 2022, 7:16 PM
Slick
Slick - avatar
0
total=0 x=0 while x<5: age=int(input()) if age>3: total+=100 x=+1 print(total)
29th May 2022, 7:00 PM
Mohammad Zakir
0
?
29th May 2022, 7:11 PM
Mohammad Zakir
0
Thanks sir....
29th May 2022, 7:18 PM
Mohammad Zakir
0
Ok sir....
29th May 2022, 7:47 PM
Mohammad Zakir