Python Forum
Need help with "IndentationError: expected an indented block"
Thread Rating:
  • 3 Vote(s) - 3.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with "IndentationError: expected an indented block"
#4
There is no indent space between the function declaration and body.


It should be like this.
def print2Smallest(arr):
 
	arr_size = len(arr)
	if arr_size < 2:
		print "invalid output"
		return
Text editors like Notepad++ have the option of indenting the lines of code.
Select the text within the function body and use indent option.
Reply


Messages In This Thread
RE: Need help with "IndentationError: expected an indented block" - by Pranav - Mar-02-2020, 06:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  IndentationError: expected an indented block python1980 3 7,811 Dec-03-2017, 10:00 PM
Last Post: buran
  IndentationError: unexpected indent belikewater 6 11,052 Oct-31-2017, 12:32 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020