Spam=“eggs” print(spam*3) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Spam=“eggs” print(spam*3)

The output is eggseggseggs My question is why the ouput is not ‘eggseggseggs’ What is the tpye of output Thanks a lot

25th Aug 2019, 2:14 PM
Liu
1 Answer
+ 4
The quotes are just the markers for the string literal. You're basically telling Python: 'I am not writing code here - this is supposed to be a string!' Consequently, the string is only what's in between - and that's what you display with print.
25th Aug 2019, 2:42 PM
HonFu
HonFu - avatar