How to let user type a number and then use the function to return that number is odd or even

Viewed 27

def function(number):
    if number % 2 == 0:
        number = "even"
        return number
    else:
        number = "odd"
        return number

function(input("5"))
1 Answers

You would have to take the user-input, and then run the function with the number the user did type. example:

userinput = input("Type a number: ")

then... print(function(userinput))

Related