Skip to content

Instantly share code, notes, and snippets.

@KimBoWoon
Created January 21, 2015 10:42
Show Gist options
  • Save KimBoWoon/b57c5f60d9aed1825293 to your computer and use it in GitHub Desktop.
Save KimBoWoon/b57c5f60d9aed1825293 to your computer and use it in GitHub Desktop.
10진수를 입력받아 16진수로 변환 출력문이 맘에 안
__author__ = 'user'
string = "0123456789ABCDEF"
Q = list()
userInput = input("Input : ")
while (True):
Q.append(int(userInput) & 0xf)
userInput = int(userInput) >> 4
if (int(userInput) == 0):
break
Q.reverse()
for x in Q:
print(string[x])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment