Operand | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

Operand

Hi, Suppose x='123' x+='gfr' print (x) will result 123gfr Question: Can I substract 'gfr' as well?

6th Dec 2016, 5:47 AM
Grigor
1 Réponse
+ 3
Subtracting strings by '-' operator is not defined, but you can call replace method on a string. Examples: "foo bar baz".replace("bar ", "") "123gfr".replace("gfr", "")
6th Dec 2016, 6:56 AM
Dominik Magdaleński
Dominik Magdaleński - avatar