0
How do i solve for valueerror in python?
I'm getting value error when i compare string elements. I've tried using lambda function to assign and check for equality but it returns bool which I'm unable to use further. Example: DEL BOM DEL I've tried converting this to a list and check str[0]==str[2] which returns an error. Any assistance would be greatly appreciated.
3 ответов
+ 3
I am not completely sure what you are trying to accomplish.
Can you maybe explain in more detail?
+ 1
If I'm understanding correctly, you want to check, from the string "DEL BOM DEL", that the first and third words are the same, right?
string = "DEL BOM DEL"
lst = string.split()
print(lst[0] == lst[2]) # true