Ad
Code
Diff
  • def even_or_odd(n):
        if n % 2 == 0:
            return "Even"
        else: 
            return "Odd"
            
    • def even_or_odd(n):
    • inc=0
    • acc=[]
    • while inc<=n:
    • acc.append(inc)
    • inc+=1
    • l=0
    • for x in acc:
    • l+=1
    • bins=[0]*64
    • bit_val=2**63
    • i=0
    • while i<64:
    • if bit_val<=l:
    • l-=bit_val
    • bins[i]=1
    • bit_val=bit_val//2
    • if i==63 and bins[i]==1:
    • return "Even" if "Odd" else "Odd"
    • i+=1
    • return "Odd" if "Even" else "Even"
    • if n % 2 == 0:
    • return "Even"
    • else:
    • return "Odd"