+ 1

Value Error

When I assign a variable x as x = int(y) where y is string type variable, but contains only integers i get a value error: invalid literal for value with base 10: '1]' what's that supposed to mean?

13th Oct 2016, 4:18 PM
Adwait Bhope
Adwait Bhope - avatar
4 Answers
+ 1
although you say that y only contain integers, the only possible way I can think that could result in the ValueError given is y="1[" I typed, y="1[" x=int(y) and got the same error; ValueError: invalid literal for value with base 10: '1[' so please check for some sort of logic error
13th Oct 2016, 5:24 PM
Sunera
Sunera - avatar
+ 1
No actually.. I tried again. And the issue is more complex i have used what I said above in a function which was from, say p to q there's another function from q to r, and I've used "return" to get the output of 1st function as input for the second, in order to achieve p to r. now the thing is, if I run only 1st function, ir runs fine. it gives the error I said, when I run both functions (like I said above)
13th Oct 2016, 5:49 PM
Adwait Bhope
Adwait Bhope - avatar
0
can you please tell me what is the purpose of these p,q,r functions do they return strings or integers?
13th Oct 2016, 5:59 PM
Sunera
Sunera - avatar
0
gonna guess that the return statement is not returning a number by itself. maybe a list with one item?
13th Oct 2016, 7:01 PM
Luke Armstrong