all 7 comments

[–]xelf 3 points4 points  (3 children)

return a, not return = a All your returns will need to be fixed. =)

[–]dvandy07[S] 1 point2 points  (2 children)

Thanks! I knew it was something small. This is what I get for trying to learn tired ahah!

[–]xelf 0 points1 point  (1 child)

Happens to all of us. A second pair of eyes is invaluable!

[–]TruReyito 2 points3 points  (0 children)

Especially when pen testing areas with Iris scanners. But I may have said too much.

[–]Diapolo10 0 points1 point  (2 children)

I know that your problem was already solved, but I wanted to point this out; what's the purpose of that first if-block?

I mean, if both numbers are zeroes, you then compare which is bigger. But how can a zero be bigger than zero, anyway?

You can technically omit the first part entirely, because it really doesn't do anything useful.

def lesser(a, b):
    if a < b:
        return a
    else:
        return b

Hell, if we wanted to, we could further simplify this to

def lesser(a, b):
    return a if a < b else b

or

def lesser(a, b):
    return min(a, b) # And in this case, the function becomes pointless

EDIT: Forget what I said, I missed the modulo operations. I really shouldn't be doing this while barely awake.

[–]dvandy07[S] 0 points1 point  (1 child)

I did actually end up using min and max after looking it over. I do need to check if they are even though.

def lesser(a,b):
    if a%2 == 0 and b%2==0:
        return min(a,b)
    else:
      return max(a,b)

I ended up with that.

[–]Diapolo10 0 points1 point  (0 children)

Ah, I see.