CodeSolved

Solved Programming Questions & Exercises

IndentationError error in Python

Technical question 2040/ Download 340 Views

Hi, I wrote this pumpkin but it gives me an indentation error. I don't know where the problem is. Can you help?

IndentationError: expected an indented block

for i in range(5):
print(i)

4 Answers

Problem of not using indentation (alignment) on the lineprint(i)Is. You should align this line with one surface (usually 2 intervals or one tab). The correct code is as follows:

for i in range(5):
    print(i)
Ai Download Python

Well, one of the important rules of the Python language is:
It should be used after the statements or functions that or any ... which is then used.
We have to put as much as 4 spies or a distance tab.

The correct code is this

    for i in range(5):
        print(i)

The order you want to run inside the elaboral should be ahead of that phrase above

Aerf123 Download Python

Hi again. Remember the gaps in Python. For example you can't say:

def hello():
print("Hello world!")

To write rings and functions, you need to leave 4 spies or spaces before their body.

Submit answer

Submitting answers is currently unavailable.

×
×
Close