Skip to content

Instantly share code, notes, and snippets.

@kendhia
Created December 30, 2016 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kendhia/56cef37bd2fc14a6444ff48c5f74528a to your computer and use it in GitHub Desktop.
Save kendhia/56cef37bd2fc14a6444ff48c5f74528a to your computer and use it in GitHub Desktop.
yeap
num = int(input(""))
while(num != 0):
num_bin = bin(num)[2:]
odds_bin = ""
evens_bin = ""
j = 0
for i in range(0, len(num_bin)):
if (int(num_bin[i])%2== 0):
odds_bin += "0"
evens_bin += "0"
else:
if (j % 2 == 0):
j += 1
odds_bin += "0"
evens_bin += num_bin[i]
else:
j += 1
odds_bin += num_bin[i]
evens_bin += "0"
if (int(odds_bin, 2)%2 == 0): print(int(evens_bin, 2), int(odds_bin, 2))
else :print(int(odds_bin, 2), int(evens_bin, 2))
num = int(input(""))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment