IndentationError: expected an indented block while printing

Question:

I keep getting indentation errors when I print out stuff in python

inp = input('You are at crossways, where do you want to go? type "left" or "right"')
if inp is 'left':
print("You didn't die. Do you want to wait for a ship or wait for a boat or swim ? Type swim or boat or ship ")

I’m making a game btw
the error I get the error at letter w in the word "swim"

enter image description here <- the error

Asked By: Malak Anas

||

Answers:

ok, the code you made was…

inp = input('You are at crossways, where do you want to go? type "left" or "right"')
if inp is 'left':
print("Luckily you didn't die. Do you want to wait for a ship or wait for a boat or swim ? Type swim or boat or ship ")

the fixed code should be like this.

inp = input('You are at crossways, where do you want to go? type "left" or "right" n')
if inp == 'left':
  print("You didn't die. Do you want to wait for a ship or wait for a boat or swim ? Type swim or boat or ship ")

I changed the if inp is 'left' to if inp == 'left'
I also indented the print after the if statment, as that is probably the cause of the error.

I hope this fixed the error 😀

Answered By: A.H Moussa
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.