Print "Spam " "and " "eggs"


#1



In String Concatenation the codes
print "Spam "+"and "+"eggs"
print "Spam " "and " "eggs"
return the same value Spam and eggs
So why add + sign


Replace this line with your code.


#2

Hi @prafuls,

Yes, this is allowed ...

print "Spam " "and " "eggs"

However, omitting the + operators can make expressions confusing when they are longer and more complex. For the sake of readability, it is better to include the operators.

If the expression involves some variables rather than only string literals, then the + operators must be included in order to perform the concatenations.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.