+ 1

What is the benefit of "+" sign when I can add two strings without it?

Example: print("You" ", " "Me") is similar to print("You"+", "+"Me")

23rd Feb 2018, 3:50 AM
New_Bin
3 Antworten
+ 4
Because of this: >>> a='v' >>> print('aa' a) SyntaxError: invalid syntax >>> print('aa'+a) aav If your text is in a variable, you need the '+'
23rd Feb 2018, 4:23 AM
Cosme
Cosme - avatar
+ 1
But I don't even mention any variable in my question #Cosme
23rd Feb 2018, 4:41 AM
New_Bin
+ 1
comma uses a space by default. Change it with the sep = 'choose any char'. Convenience. I think formatting is used more than either of these ways.
23rd Feb 2018, 5:20 AM
emmey
emmey - avatar