Search code examples
pythonvalueerror

What is the error in int('253' ,4) python code?


ValueError: invalid literal for int() with base 4: '253'
The Error in the code. Please explain why is it an error?


Solution

  • int('253',4) will return value to base 4.

    And the base 4 only containing value: 0,1,2,3. You can take a look in here.

    You provided 5, that is the issue.