IndentationError: expected an indented block in Python
Dung Do Tien
Aug 15 2021
159
Hello Guys, I am a newbie in Python. And I have a method to help check integer number and print out messages as below:
def CheckIntegerNumber(num):
if num >= 1:
print("It is positive number")
elif num < 0:
print("It is negative number")
else:
print("It is zero")
CheckIntegerNumber(1)
But when I run, I got an error IndentationError: expected an indented block
File "main.py", line 3 print("It is positive number") ^ IndentationError: expected an indented block
I really don't know what is that means? I check syntax is correct.
How can I fix it?
Have 1 answer(s) found.
-
จ0
จักรพงษ์ รักษาศรี Aug 15 2021
This error throw because the syntax format code is incorrect. You can insert one tab in the front of
print()
methods. Like below:def CheckIntegerNumber(num): if num >= 1: print("It is positive number") elif num < 0: print("It is negative number") else: print("It is zero") CheckIntegerNumber(10)
hope it works for you.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.