+ 3
Error in python
I have written a code in python but it keeps on sayings that you can't add two strings. Please help me figure out the bug. https://code.sololearn.com/cINf99vkP9TX/?ref=app
10 Antworten
+ 5
https://code.sololearn.com/c57lHpPn34Xd/?ref=app
This code works in general no matter where that character is.
+ 4
You can't use the minus operator in strings, that's just how strings work
+ 4
To remove the character, you can do:
string.replace(character,"")
+ 4
Lucky Luke Yours is a specific case here.
Suppose you want to remove any character once, we need better code
+ 3
You are trying to substract 2 strings, which is not possible.
+ 3
thanks
+ 2
Here is a working version of your code which removes the first letter of a string.
https://code.sololearn.com/cH7zt2I3e26B/?ref=app
+ 2
Dark Angel you are right, replace is more general.
+ 2
thanks a lot
+ 2
I also figured out to convert them to lists and then subtract them