What if it was >>> x*="eggs" or what if % was used?? Will you still get spameggs as the output? | Sololearn: Learn to code for FREE!
0

What if it was >>> x*="eggs" or what if % was used?? Will you still get spameggs as the output?

>>> x = "spam" >>> print(x) spam >>> x += "eggs" >>> print(x) spameggs

5th Feb 2019, 5:06 PM
M. Anne
M. Anne - avatar
1 Answer
+ 5
You can't multiply strings, so x *= eggs wouldn't work. You can multiply integers and strings, like 3 * 'spam'. Why don't you just try it out in the playground though?
5th Feb 2019, 5:26 PM
Anna
Anna - avatar