Don’t worry, unlock all articles / blogs on PrepInsta by just simply logging in on our website
Type atleast 3 characters
Popular Searches
Trending Pages
Notifications Mark All Read
No New notification
September 29, 2022
On this page we will learn the concept of decimal to hexadecimal conversion in Python.
We will also learn to Decimal to Hexadecimal Conversion in Python Programing language.
To know how to solve this you must first have knowledge of ASCII Table.
The program works in two cases
Decimal to Binary conversion
Decimal to Octal Conversion
Decimal to Hexadecimal Conversion
Binary to Octal conversion
Octal to Binary conversion
Quadrants in which a given coordinate lies
def convert(num): hexa = [] while num != 0: rem = num % 16 if rem < 10: hexa.append(chr(rem + 48)) else: hexa.append(chr(rem + 55)) num = num // 16 hexa.reverse() return ''.join(hexa) decimal = 2545 print("Hexadecimal :", convert(decimal))
Hexadecimal : 9F1
For similar Questions click on given button.
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Login/Signup to comment
num = 2545 hex = hex(num)[2:] # remove the ‘0b’ prefix print(hex)
Get Hiring Updates right in your inbox from PrepInsta
num = 2545
hex = hex(num)[2:] # remove the ‘0b’ prefix
print(hex)