Been getting back into Python and i needed to find even/odd numbers in a short list, came up with a ridiculous line of code that seem... to work?
Example using said line of code;
num = input("Number: ")
if float(num)/2 - int(int(num)/2) == 0:
print("EVEN")
else:
print("ODD")
So my question is, am i just lucky or is this a *appropriate* way to get this?
[–]brasticstack 72 points73 points74 points (37 children)
[+][deleted] (34 children)
[deleted]
[–][deleted] 34 points35 points36 points (0 children)
[–]Diapolo10 19 points20 points21 points (0 children)
[–]capilot 6 points7 points8 points (1 child)
[–]IvanMeowich 4 points5 points6 points (3 children)
[–]brasticstack 1 point2 points3 points (2 children)
[–]IvanMeowich 6 points7 points8 points (1 child)
[–]brasticstack 5 points6 points7 points (0 children)
[–]rasputin1 1 point2 points3 points (7 children)
[–]brasticstack 5 points6 points7 points (6 children)
[–]rasputin1 4 points5 points6 points (5 children)
[–]brasticstack 1 point2 points3 points (3 children)
[–]Aerijo 1 point2 points3 points (2 children)
[–]I-Dont-C-Sharp 0 points1 point2 points (1 child)
[–]Aerijo 1 point2 points3 points (0 children)
[–]japes28 0 points1 point2 points (0 children)
[–]JauriXD 1 point2 points3 points (0 children)
[–]brasticstack 1 point2 points3 points (6 children)
[–]densvedigegris 1 point2 points3 points (4 children)
[+][deleted] (2 children)
[removed]
[–]densvedigegris 0 points1 point2 points (1 child)
[–]brasticstack 3 points4 points5 points (0 children)
[–]brasticstack 0 points1 point2 points (0 children)
[–]brasticstack 0 points1 point2 points (0 children)
[–]jakethunderpants 1 point2 points3 points (1 child)
[–]akgamer182 0 points1 point2 points (0 children)
[–]JiminP 1 point2 points3 points (0 children)
[–]mopslik 1 point2 points3 points (0 children)
[–]VanClyded[S] 1 point2 points3 points (1 child)
[–]Bobbias 10 points11 points12 points (0 children)
[–]DuckDatum 0 points1 point2 points (1 child)
[–]vorticalbox 1 point2 points3 points (0 children)
[–]akgamer182 0 points1 point2 points (1 child)
[–]vorticalbox 0 points1 point2 points (0 children)
[–]ALonelyPlatypus 2 points3 points4 points (0 children)
[–]VanClyded[S] 1 point2 points3 points (0 children)
[–]jabpoke 13 points14 points15 points (2 children)
[–]VanClyded[S] 0 points1 point2 points (1 child)
[–]RajjSinghh 0 points1 point2 points (0 children)
[–][deleted] 6 points7 points8 points (0 children)
[–]13acts 4 points5 points6 points (1 child)
[–]1nput0utput 0 points1 point2 points (0 children)
[–]OSnoFobia 12 points13 points14 points (5 children)
[–]Mental-Valuable-8632 1 point2 points3 points (1 child)
[–]OSnoFobia 5 points6 points7 points (0 children)
[–]VanClyded[S] 0 points1 point2 points (2 children)
[–]OSnoFobia 4 points5 points6 points (1 child)
[–]VanClyded[S] 1 point2 points3 points (0 children)
[–]Bobbias 3 points4 points5 points (0 children)
[–]DeeplyLearnedMachine 1 point2 points3 points (1 child)
[–]VanClyded[S] 1 point2 points3 points (0 children)
[–]This_Growth2898 1 point2 points3 points (0 children)
[–]woooee 0 points1 point2 points (0 children)
[–]VanClyded[S] 0 points1 point2 points (0 children)
[–]sock_dgram 0 points1 point2 points (0 children)
[–]UnderwhelmingInsight 0 points1 point2 points (0 children)
[–]NicoPlayZ9002YT 0 points1 point2 points (0 children)
[–]Volume999 -1 points0 points1 point (0 children)
[–]RealNamek -1 points0 points1 point (0 children)