0
ValueError...
How to fix.... ....
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
+ 3
Post the code
+ 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.
+ 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
+ 1
https://code.sololearn.com/cRUEo1Pg5YF9/?ref=app
0
total=0
x=0
while x<5:
age=int(input())
if age>3:
total+=100
x=+1
print(total)
0
?
0
Thanks sir....
0
Ok sir....