x=4 x*=3 print(x) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

x=4 x*=3 print(x)

So I’m kinda confused here I already put in the code and the answer is 12 but I don’t know what is happening in this code

11th Sep 2021, 1:34 PM
Dima Melnichuk
10 Answers
+ 2
4*3= 12 📜
12th Sep 2021, 9:15 AM
Shubham Bhatia
Shubham Bhatia - avatar
+ 2
It's easy :) You can also use this equation x*=3 is the same with x*3 4 * 3 = 12
12th Sep 2021, 6:25 PM
Rostyslaw Baidak
Rostyslaw Baidak - avatar
+ 1
x*=3 is interpreted as x=x*3
11th Sep 2021, 1:40 PM
Abhay
Abhay - avatar
+ 1
Ohh alright i got it i thought that the x on the left side was 4 and the other one on the right was 4 like this 4=4*3
11th Sep 2021, 1:42 PM
Dima Melnichuk
+ 1
In second line, you can also use this equations x*=3 is the same with x = x*3 When you initialize x first, it equals 4. If you initialize again as x*=3 (x multiple by 3, so 4*3=12) it equals 12. Happy coding!
11th Sep 2021, 1:42 PM
mesarthim
mesarthim - avatar
+ 1
You are welcome <3
11th Sep 2021, 2:50 PM
Tanvir Salehin
Tanvir Salehin - avatar
+ 1
Thank you for the help.
12th Sep 2021, 9:49 AM
Shubham Bhatia
Shubham Bhatia - avatar
0
4 * 3 = 12
11th Sep 2021, 2:35 PM
AYUSH KUMAR
AYUSH KUMAR - avatar
0
First, you are assigning 4 to x. So the value of x is 4. Then you are doing x *= 3 which means x = x * 3 which translates to x = 4 * 3 (because you assigned 4 to x). So, you ar now assiging 4 * 3 or 12 to x. That's why, x is 12 Hope you got the point. Thank you
11th Sep 2021, 2:48 PM
Tanvir Salehin
Tanvir Salehin - avatar
0
Yeha i do thank you
11th Sep 2021, 2:49 PM
Dima Melnichuk