Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

Python error IndentationError expected an indented block

Asked by Peter Wilkins Jul 17, 2021 1.2K views 1 answer
Share

About this question

I am trying to execute the following python code:

def example(p,q):
a = p.find(" ")
b = q.find(" ")
str_p = p[0:a]
str_q = p[b+1:]
if str_p == str_q:
    result = True
else:
    result = False
return result

And I get the folloeing error:

IndentationError: expected an indented block


Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.