0
Wtf when I run this code it gives me an error of indented block...i tried it several time but in vein. What is indented?
i = 2 while i <=6: print (i) i=i+1 print("Finished!")
2 Respuestas
+ 7
Indenting means adding blank spaces at the beginning of a Python line. Roughly speaking, an indented line doesn't begin at column 1, but at col 3 or 5 or 7... This way is how blocks are identified in Python.
Take a look at your code: which sentence(s) are to be included inside the while loop? The print(i)? Also the i=i+1? The final print as well?
Depending on the answers, you should indent the corresponding lines.
[EDIT:] For example:
for x in range(20):
print(x) # this line is indented
print("Finished") # this line is NOT
+ 4
Python need ident the code:
try this:
while i<=6
print (i)
i = i + 1
print ("Finished")