Why the different answer 🤔 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why the different answer 🤔

x=3 x*=4+5 print (x) x=3 x=x*4+5 print (x)

31st May 2020, 10:09 AM
Prince Rupam 🎶
Prince Rupam 🎶 - avatar
2 Answers
+ 6
You can remember one simple rule: What's right from the = (no matter if simple = or += etc) is evaluated first! x *= (4+5) means x *= 9 x = (x*4+5) means x = (12+5)
31st May 2020, 10:26 AM
HonFu
HonFu - avatar
31st May 2020, 10:10 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar