+ 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

9th Jan 2022, 2:11 AM
Harsha S
Harsha S - avatar
2 ответов
+ 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
9th Jan 2022, 2:27 AM
Angelo
Angelo - avatar
+ 2
Angelo thank you for the explanation
9th Jan 2022, 2:31 AM
Harsha S
Harsha S - avatar