Skip to content

Instantly share code, notes, and snippets.

@kendhia
Created December 30, 2016 20:57
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/d79f3bd00ed6c29c82d01f300eecf93a to your computer and use it in GitHub Desktop.
Save kendhia/d79f3bd00ed6c29c82d01f300eecf93a to your computer and use it in GitHub Desktop.
final1
num = int(input(""))
while(num != 0):
num_bin = "00" + bin(num)[2:]
odds_bin = ""
evens_bin = ""
for i in range(len(num_bin)):
if (i%2 == 0):
odds_bin += num_bin[i]
evens_bin += "0"
else:
evens_bin += num_bin[i]
odds_bin += "0"
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