DEV Community


Posted on

Short Python Problem

I was also struggling whit this one... didn´t really search for any help tho.
Alt Text

Discussion (2)

hanpari profile image
Pavel Morava • Edited on

The code logic is flawed or superfluous. You do not need the result tuples at all.

if me and him is bigger than 7, the result is two.

The other branches follow similar logic. Your tuples are unnecessary. The solution is overcomplicated.

But in this particular case, you may have problem simply because you use print instead of return.

Your function returns None all the time.

To make it more elegant you may try to utilize min and max functions.

8koi profile image
Hachikoi Author • Edited on

Thanks for the advice! but my mistake wasn´t there, that was what they were asking for, me and him must be > 7 and nobody from 1-2
And about the print instead of Return I make it like that because I´m lazy and I don´t want to write the "print" in:
for me (in pycharm) doesn´t return any kind o None, in this case, But yeah It did before! in another exercise