+ 1
why is it <=36?
I wrote a code to find the decimal of number in other base. If base is more than 36, it gives error. why? https://code.sololearn.com/cW058zo5chX7/?ref=app
2 Answers
+ 5
It's a design choice of int()
For bases up to 36 you can rapresent the digits with the characters:
0123456789abcdefghijklmnopqrstuvwxyz
(which are 36)
Base 10 uses 0 to 9
Base 16 uses 0 to f
...
if 'z' is 35 what should 36 be?
For higher bases there isn't really an agreement on what characters should be used, so int() just stops there
+ 2
Angelo thank you for the explanation