Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def convert_10_to_16(n):
- hexlist =[]
- x = n // 16
- if x < 10:
- hexlist.append(x)
- elif (x == 10):
- hexlist.append('A')
- elif (x == 11):
- hexlist.append('B')
- elif (x == 12):
- hexlist.append('C')
- elif (x == 13):
- hexlist.append('D')
- elif (x == 14):
- hexlist.append('E')
- elif (x == 15):
- hexlist.append('F')
- y = n % 16
- if y < 10:
- hexlist.append(y)
- elif (y == 10):
- hexlist.append('A')
- elif (y == 11):
- hexlist.append('B')
- elif (y == 12):
- hexlist.append('C')
- elif (y == 13):
- hexlist.append('D')
- elif (y == 14):
- hexlist.append('E')
- elif (y == 15):
- hexlist.append('F')
- return ''.join(hexlist)
- def convert_10_to_16(n):
- hexlist =[]
- x = n // 16
- if x < 10:
- hexlist.append(x)
- elif (x == 10):
- hexlist.append('A')
- elif (x == 11):
- hexlist.append('B')
- elif (x == 12):
- hexlist.append('C')
- elif (x == 13):
- hexlist.append('D')
- elif (x == 14):
- hexlist.append('E')
- elif (x == 15):
- hexlist.append('F')
- y = n % 16
- if y < 10:
- hexlist.append(y)
- elif y >= 10:
- z = y
- convert_10_to_16(z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement