0

How would this be evaluated?

What is the result ? >>> x"= "a" >>> x*=3 print(x)

30th Aug 2019, 3:46 AM
Nihitha Datla
2 Answers
+ 3
I'm pretty sure "= is a typo. You probably mean x = "a" x *= 3 The string "a" is assigned to variable x, x is multiplied by 3 and reassigned to x. When a string is multiplied by a number, you get a new string which is the original string repeated for that number of times. Since "a" was multiplied by 3 and stored in x, the result of printing x would be aaa
30th Aug 2019, 3:56 AM
Hatsy Rei
Hatsy Rei - avatar
0
thanks!!
31st Aug 2019, 12:05 AM
Nihitha Datla