need help plz | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

need help plz

What is the output of this code? >>> x = 4 >>> x *= 3 >>> print(x)

8th Mar 2019, 11:05 PM
Miguel Sanchez
Miguel Sanchez - avatar
2 Answers
+ 5
Output: 12 In line 1, the value 4 is assigned to x. In line 2, x *= 3 is the same as x = x * 3, which becomes: x = 4 * 3, and then x = 12. print(x) just prints x (or 12).
8th Mar 2019, 11:13 PM
Rowsej
Rowsej - avatar
+ 1
12. Because, x*=3 means x=x*3
9th Mar 2019, 12:27 AM
Home Number
Home Number - avatar