In-Place Operators | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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