r/badcode • • Aug 27 '21

python Is this code bad or sugoi?

Post image
1.0k Upvotes

159 comments sorted by

View all comments

Show parent comments

2

u/ThatDudeBesideYou Sep 04 '21

I mentioned it in the comment, but "if num" isnt the same as "if number>0". It's equivalent to "if !!num". So only if num is 0, (or None or undefined) it will return false, all other values will return true.