- 3

Can anyone help me with phyton m

I can't get the output in lesson 24 problem

1st Mar 2022, 3:28 PM
Harish R
16 Respostas
+ 5
Do it like this total = 0 x = 0 while x<5: age = int(input()) if age >3: total+=100 x+=1 print(total)
1st Mar 2022, 3:43 PM
Simba
Simba - avatar
+ 6
20 3015 Harish , please link your attempt here, so that we can see what the issue is. thank you!
1st Mar 2022, 3:31 PM
Lothar
Lothar - avatar
+ 6
20 3015 Harish , please use a proper indentation in your python code. this means 4 spaces per indentation level. this is recommended in the PEP 8: https://www.python.org/dev/peps/pep-0008/
1st Mar 2022, 3:48 PM
Lothar
Lothar - avatar
+ 4
You need to unindent last 2 lines to work it. I mean x+=1 should be same as if statement block while print needs to be outside loop.
1st Mar 2022, 3:39 PM
Simba
Simba - avatar
+ 3
Simba that's perfectly works Thanks a lot
1st Mar 2022, 3:45 PM
Harish R
+ 1
What is your main question
1st Mar 2022, 3:40 PM
NonStop CODING
NonStop CODING - avatar
+ 1
Yes but there must be input
1st Mar 2022, 3:42 PM
Harish R
+ 1
20 3015 Harish Are you trying to take in put each time the while loop runs ?
1st Mar 2022, 3:43 PM
NonStop CODING
NonStop CODING - avatar
0
Which 1 bro 24.1 has 3 problems
1st Mar 2022, 3:31 PM
NonStop CODING
NonStop CODING - avatar
0
24.2 the practice
1st Mar 2022, 3:32 PM
Harish R
0
total = 0 x = 0 while x<5: age = int(input()) if age >3: total+=100 x+=1 print(total) I don't know where I did a mistake
1st Mar 2022, 3:33 PM
Harish R
0
It's showing there is mistake in line 5 Age = int(input()) What should I do Can anyone share their codes
1st Mar 2022, 3:38 PM
Harish R
0
I used bits and saw the answer I exactly have the same code But I got a E0F error in line 5 How should I fix it The problem is on line 5
1st Mar 2022, 3:41 PM
Harish R
0
Simba It is showing error with the input function I think we need to avoid such problems
1st Mar 2022, 3:42 PM
NonStop CODING
NonStop CODING - avatar
0
I am frustrated by this
1st Mar 2022, 3:43 PM
Harish R
0
is it this? total=0 x=0 while x<5: age = int(input()) if age>3: total += 100 x+=1 print (total)
3rd Mar 2022, 2:49 AM
Bluegray
Bluegray - avatar