Programming humor on reddit used to be excellent bits like this but then it devolved into new learners jumping straight to the irony they didn’t understand and flooded the sub with nonsense.
I miss these bits.
btw it does get easier
import math
defis_even(num):
if num in [i for i inrange(1000) iffloat(i)/2.0 == math.floor(float(i)/2.0)]:
print("true")
else:
print("false")
Obviously one would need to increase the range for bigger numbers but this code is optimized.
Programming humor on reddit used to be excellent bits like this but then it devolved into new learners jumping straight to the irony they didn’t understand and flooded the sub with nonsense.
I miss these bits.
btw it does get easier
import math def is_even(num): if num in [i for i in range(1000) if float(i)/2.0 == math.floor(float(i)/2.0)]: print("true") else: print("false")
Obviously one would need to increase the range for bigger numbers but this code is optimized.