How does "print(int("0x68",16)) " work? how is the prefix being handled? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How does "print(int("0x68",16)) " work? how is the prefix being handled?

I understand that the 68 in it's hexadecimal form is being converted to an int, which is then converted to a string "h" via the chr() function, but how come the 0x prefix is being ignored? and why add 16 as a second parameter to int()?

25th Jul 2018, 3:36 PM
X-1
X-1 - avatar
1 Answer
0
see if you can figure it out by looking at this. https://code.sololearn.com/clOli9YsMz2K/?ref=app
25th Jul 2018, 5:17 PM
Louis
Louis - avatar