hex(x) being x the integer you want to convert
# plz suscribe to my youtube channel -->
# https://www.youtube.com/channel/UC-sfqidn2fKZslHWnm5qe-A
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))
print(int("61", 16)) # output 97 (ascii value "a")