+ 1

printing Strings with and without using print function

>>> "Spam"+'eggs' 'Spameggs' >>> "Spam" + 'eggs' 'Spameggs' >>> print ("Spam"+'Eggs') SpamEggs >>> From above output Que1 If I dont use print function then i get output in single inverted comma but if I use print function it gives output without inverted comma. Is there a difference in these two methods ?

11th Oct 2016, 6:05 PM
Gagan Singh
Gagan Singh - avatar
1 Odpowiedź
+ 2
If you run "Spam" + "eggs" in Idle it won't work but because you are running it in the shell it works; however, print ("spam" + "eggs") it will work. your code will be better if you remove the + sign because you don't really need it.
23rd Oct 2016, 7:22 AM
6085
6085 - avatar