0

I have to create a function that determines the largest of 3 values. The code works for certain cases but not for all. For example, if I enter the numbers 11,12,5 the function will return the number 5. However, if I enter the numbers 46,44,48 then it will correctly return the number 48. I have looked over the code several times and cannot seem to determine where I am going wrong. Any advice would be appreciated.

Here is the code I am working with:

a = input("Enter first number")
b = input("Enter second number")
c = input("Enter third number")

def findlargest(a,b,c):
    z = 0
    if a>=b and a>=c:
        z = a
    elif b>=a and b>=c:
        z = b
    else:
        z = c
    return z


print("The largest number is:",findlargest(a,b,c))

0 Answers0