84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
I'm getting this error in my code:
ValueError: invalid literal for int() with base 10: ''.
What does it mean? Why does this happen and how to solve it?
This error message means that the string supplied to int cannot be parsed as an integer. The last part after : displays the provided string.
int
:
In the case of the problem description, the input is an empty string , written as ''.
''
Here's another example - strings representing floating point values cannot be converted directly with int:
>>> int('55063.000000') Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with base 10: '55063.000000'
Instead, first convert to float:
float
>>> int(float('55063.000000')) 55063
This error message means that the string supplied to
int
cannot be parsed as an integer. The last part after:
displays the provided string.In the case of the problem description, the input is an empty string , written as
''
.Here's another example - strings representing floating point values cannot be converted directly with
int
:Instead, first convert to
float
: