aboutsummaryrefslogtreecommitdiff
path: root/challenge-119/james-smith/python/ch-1.py
blob: 5ce0a2ff8d7563136d17f774b5700fa912eef082 (plain)
1
2
3
4
5
6
7
8
9
TESTS=[[15,240],[165,90]]

def swap_nibbles(_):
  return (_>>4)|((_&15)<<4)

for t in TESTS:
  print( 'OK' if swap_nibbles(t[0])==t[1] else 'Not OK' )
  print( 'OK' if swap_nibbles(t[1])==t[0] else 'Not OK' )