Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. def N(x):
  2. n = ""
  3. if not x:
  4. return 0
  5. while x > 0:
  6. a = str(x % 16)
  7. n = c[a] + n
  8. x = x // 16
  9. return n
  10.  
  11. c= {'0': '0', '1':'1', '2':'2', '3':'3', '4':'4', '5':'5', '6':'6', '7':'7', '8':'8', '9':'9', '10':'A', '11':'B', '12':'C', '13':'D', '14':'E', '15':'F'}
  12. b = int(input())
  13. if b >= 0:
  14. print(N(b))
  15. else:
  16. print('-', N(-b), sep ="")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement