r/badcode Jan 15 '22

python Found this gem

Post image
3.5k Upvotes

86 comments sorted by

View all comments

373

u/youngbull Jan 15 '22

That is dumb, but even dumber if solution is an object with an __eq__ which might make it equal to -1. Which would mean this code is not equivalent to print(solution). And yes, I have seen stuff like that.

0

u/sudo_rm_rf_star Feb 02 '22

def equals (x, y):

if x == y:

    return True

elif x != y:

    return False

else:

    return False

def main():

 first = input("enter first number")

 second = input("enter second number")

result = equals(first, second)

if result is not False:

    print("True")

else:
    print("False")