In-Place Operators | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
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 ответов
+ 8
since x is assigned a x *= 3 means x = x*3 = aaa.
1st Jul 2020, 10:23 AM
Nilesh
Nilesh - avatar
+ 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
Nilesh - avatar
+ 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