In-Place Operators | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In-Place Operators

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

1st Jul 2020, 10:13 AM
Basit Ali
Basit Ali - avatar
5 Answers
+ 8
since x is assigned a x *= 3 means x = x*3 = aaa.
1st Jul 2020, 10:23 AM
Nilesh
+ 6
Nilesh✰ x*=3 means x = x*3 Or x = 'a'*3 or aaa
1st Jul 2020, 12:38 PM
SR ​
SR ​ - avatar
+ 6
SR‎ (dm ❌) Oh sorry didn't see that 😅
1st Jul 2020, 12:38 PM
Nilesh
+ 2
put it in the playground and see
1st Jul 2020, 10:15 AM
Slick
Slick - avatar
+ 1
Console will show you: aaa
1st Jul 2020, 10:16 AM
Potato Squad
Potato Squad - avatar