+ 2
python
what is the result of this code? >>x="a" >>x*=3 print(x)
3 Answers
+ 3
error because a is not defined
+ 3
When you multiply an integer of value x with a string, it simply concatenate the string with itself x times(where x is the integer value).
>>>s = 'spam'
>>>r = s *3
>>>r
"spamspamspam"
And in your example value of x is "aaa".
- 1