Python IF ELSE statement now working
Question: Simple question for some. I have my first program I am trying to make using
python. The IF ELSE statement is not working. The output remains "Incorrect"
even if the correct number is inputted by the user. I'm curious if it's that
the random number and the user input are different data types. In saying that
I have tried converting both to int with no avail.

Code below:

    
    
        #START
    from random import randrange
    
    #Display Welcome
    print("--------------------")
    print("Number guessing game")
    print("--------------------")
    
    #Initilize variables
    randNum = 0
    userNum = 0
    
    #Computer select a random number
    randNum = randrange(10)
    
    #Ask user to enter a number
    print("The computer has chosen a number between 0 and 9, you have to guess the number!")
    print("Please type in a number between 0 and 9, then press enter")
    userNum = input('Number: ')
    
    #Check if the user entered the correct number
    if userNum == randNum:
        print("You have selected the correct number")
    else:
        print("Incorrect")
    


Answer: If you are using Python 3, change the following line:

    
    
    userNum = input('Number: ')
    

to

    
    
    userNum = int(input('Number: '))
    

For an explanation, refer to [this
document](http://stackoverflow.com/documentation/python/193/introduction-to-
python/2642/input#t=201607311149485686857).

