Nested if ... else (Python exercise)

Viewed 4268

I'm trying to build a function that checks which of a,b,c is less then returns the lesser value.

def minimal_three(a,b,c):
    if a < b:
        if a < c:
            return (a)
    elif b < a:
        if b < c:
            return (b)
    elif c < a:
        if c < b:
            return (c)
    else:
        return 'none'

So far the code runs fine until it gets to check 'c', then it doesnt return anything, nested if else statements already get really confusing to me.

6 Answers
Related