• dadarobot
    link
    fedilink
    arrow-up
    18
    arrow-down
    4
    ·
    2 years ago
    If number%2 == 0: return("Even")
    Else: return("odd") 
    
    • istdaslol@feddit.org
      link
      fedilink
      arrow-up
      5
      ·
      2 years ago

      Not all ARM CPUs support mod operations. It’s better to use bit operations. Check if the last bit is set. If set it’s odd else it’s even.