Wheres the issue in my code ? (Python 3)


#1

I cant seem to find the issue why my code isnt working , heres the code:

import random
number = random.randint(0,10)
while guess != number:
guess = int(input("Is the number "))
if guess == number:
    print("Correct!!")
elif guess < number:
    print("Its bigger")
elif guess > number:
    print("Its not that big")

error ::

guess = int(input("Is the number "))
        ^
IndentationError: expected an indented block

#2

Hi @m4rkoxx,

The error message is pretty clear, have you read it and tried fixing what it says is wrong with line 4?


#3

Im sorry im probably dumb whats the error?


#4

The statement after the While needs to have a space in between. That’s why it says indentation error.

Try this:-

import random
number = random.randint(0,10)
while guess != number:
guess = int(input("Is the number "))
if guess == number:
print(“Correct!!”)
elif guess < number:
print(“Its bigger”)
elif guess > number:
print(“Its not that big”)


#5

sorry, what I meant was add a space before:–
guess = int(input(“Is the number”))


#6

Oh yeahhh the spaces after while and other stuff… Thanks man !!!