0
Please how else can I convert an integer to hexadecimal in python. I tried hex(2356) but I got an error message.
python tutorial question https://code.sololearn.com/cx9Z2vh7Atgc/?ref=app https://www.sololearn.com/discuss/1068064/?ref=app
4 Answers
+ 6
Should work fine, I think.
print(hex(2356))
0x934
+ 1
you can do it manually by storing the remainder of that integer by 16 and then dividing it by 16 in a loop:
var res="";
var int;
while (int>0){
res = int%16 + res;
int /= 16;
}
also note that your integer should not be greater than 16,777,216
and the division should give you an integer without decimal
+ 1
also check out my code in javascript where i do just that
https://code.sololearn.com/W805C9p2MN3x/?ref=app
0
I have tried that as well but it didn't work