Home 0P3N Blog IndentationError: Expected An Indented Block
Ready to Start Your Career?
Create Free Account
authors profile image
January 1, 2016

IndentationError: Expected An Indented Block

January 1, 2016
authors profile image
January 1, 2016
Hi Perry, Thanks for the great course. I am trying to do the code along with your videos, but when ever i use print in if, for etc, i am getting below error. Can you please help how to sort this issue. `>>> def func1(): ... print "Hello WOrld" File "", line 2 print "Hello WOrld" ^ IndentationError: expected an indented block Try: print("Hello World") If you are using the new version of python. Hopes it helps you :) Keep in mind that one thing which is unique to Python is that spaces/tabs actually mean something. The error message "IndentationError: expected an indented block" would seem to indicate that your print statement should be indented to match the line above. In most programming languages, spaces or indentation are just used to make the code look better and be easier to read. In Python, it is actually part of the programming language. Putting in an extra space or leaving one out where it is needed will generate an error message. It isn't that bad once you get used to it, but can definitely cause a lot of headaches when you first start learning the language.
Schedule Demo

Build your Cybersecurity or IT Career

Accelerate in your role, earn new certifications, and develop cutting-edge skills using the fastest growing catalog in the industry