Solved

IndentationError: expected an indented block

LiamByteOP

Copied the if example into my editor, changed a bit and now get this error. The code looks fine to me.

9

Comments 5

Join the discussion

Already have an account? Log in

  1. NoahLoopsreplies: 3

    Can you paste it? Usually it's an if line ending with : and nothing indented below it.

    2
      1. NoahLoops Solutionreplies: 1

        Yep, the print needs to be indented (4 spaces is standard) to belong to the if:

        if fuel < 50:
            print("Low fuel")

        In Python the indentation is the block, there are no curly braces.

        10
    1. MateoG

      Tip: don't mix tabs and spaces. The editor here inserts 4 spaces when you press Tab, which is the safe default.

      3