vendredi 28 août 2020

IF Else Statement with user input in Python [closed]

sorry to ask this basic question. I am learning python and when i tried running the following code i am not achieving the desired result. Basically when executed, the code has to take 3 inputs from user, compare it then print eg: num1 is greatest. Then it has to print the number.

num1=input("Enter num1:")
num2=input("Enter num2:")
num3=input("Enter num3:")
def max_num(num1, num2, num3):
    if(num1>=num2 and num1>=num3):
        print("num1 is greatest")
        return num1
    elif(num2>=num1 and num2>=num3):
        print("num2 is greatest")
        return num2
    else:
        print("num3 is biggest")
        return num3

print(max_num)

Aucun commentaire:

Enregistrer un commentaire