Reputation: 17
I'm making an input system that asks for the user if the user selects low or high and then prints out if it's low or high with:
print(random.randint(1, 2))
But it gives this error:
File "main.py", line 13
print(random.randint(1, 2))
^
IndentationError: unindent does not match any outer indentation level
pls debug me here's the code
import random
print("Hello Welcome to the up down game!")
while True:
first = input("[1]Low or [2]High. Which one?\n")
print(random.randint(1, 2))
break
Upvotes: -1
Views: 98
Reputation: 24049
in python you should be careful on Indentation
, see code below: (see this ref)
import random
print("Hello Welcome to the up down game!")
while True:
first = input("[1]Low or [2]High. Which one?\n")
print(random.randint(1, 2))
break
Upvotes: 1
Reputation: 360
You have indented your code wrong.
import random
print("Hello Welcome to the up down game!")
while True:
first = input("[1]Low or [2]High. Which one?\n")
print(random.randint(1, 2))
break
Try this and it will work !
Upvotes: -1