0
Why I got this error? " File "source_file.py", line 3 print(x) ^ IndentationError: expected an indented block "
I tried to run this while loop on code play ground, but I got error, can any one tell why? note: I got it from Python lesson! x=0 while x = 20: print(x) x + = 2
4 ответов
+ 1
which python lesson did you get the code from?
after the while statement there should be an indented line, either 2 or 4 spaces usually (should be consistent throughout the file) but the print(x) is not indented (this is what the error message is suggesting). By the look of it the x+=2 should be indented too
+ 1
It worked after I fixed
line 4 / x+= 2
thnx for the tip :)
0
I guess I cant post a screenshot! otherwise I could post a screen shot, it's located at infinte while loop, after I finished that lesson I hv got a Q that I filled the blanks to answer, then I copied the code just to test it, it didnt work!
0
THE TRUMP I tried print(x'\t'), but its the same