Why am I getting this error?
ValueError: invalid literal for int() with base 10: 'ab'
It happens when try to change a string list into an int list.
x = [["a","b"], ["c"]]
y = []
for i in x:
answer = ''.join(i)
y.append(answer)
final_value = [int(n) for n in y] #the error comes from here
print(final_value)
What should I do in order to make it work?
"ab"and"c"), that are not integers, to an integer value and this will result in an error. What is your code supposed to do?