Indentation error in else statement

I wrote an else-statement after an if-statement and get the IndentationError: expected an indented block: https://www.codecademy.com/courses/learn-python-3/projects/python-magic-8-ball

Can someone help?

You might need to share your code, see How do I format code in my posts? or consider a code hosting site, e.g. repl, gists or some kind of pastebin. The actual contents of the error matter too (often it can guide to the exact line where issues pop up).

For a warning like you have it sounds like you’ve missed an indent after one of your clauses. For example-

x = 3
if x < 10:
    print('yes')  # this is fine, there is an indent
else:
print('no')  # this is an error, else expects an indent

The indent is how Python groups together code.

1 Like