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"
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 😀
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"
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 😀