0
How would this be evaluated?
What is the result ? >>> x"= "a" >>> x*=3 print(x)
2 Antworten
+ 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
0
thanks!!