Answers for "convert octal to hexadecimal python"

2

converting decimal to hex in python

def convert_to_hex(number:int):
    if number == None:
        return "Invalid input"
    elif type(number) == float:
        return "Float not handled"
    elif type(number) == str:
        temp = int(number)
        return format(temp, "02x")
    return format(number, '02x')
print(convert_to_hex(30))
print(convert_to_hex(None))
print(convert_to_hex("7"))
print(convert_to_hex(7.09))
Posted by: Guest on June-23-2021
-1

python library to convert decimal into octal and hexadecimal

dec =13
print(bin(dec),oct(dec),hex(dec))		#prints decimal,octal,hexadecimal value of 13
Posted by: Guest on July-02-2020

Code answers related to "convert octal to hexadecimal python"

Python Answers by Framework

Browse Popular Code Answers by Language