CBSE Class 11 Informatics Practices
Question 50 of 102
Python Programming Fundamentals — Question 11
Back to all questions20 300
a = 5
b = 2 * aais initialized to 5.bis set to2 * a, which means b = 2 * 5 = 10.
a += a + bThe += operator adds the value on the right to a and assigns the result back to a.
- Current values are:
- a = 5
- b = 10
- Calculation: a + b = 5 + 10 = 15
- Updating
a: a += 15 means a = a + 15 - So, a = 5 + 15 = 20.
b *= a + bThe *= operator multiplies b by the value on the right and assigns the result back to b.
- Current values are:
- a = 20
- b = 10
- Calculation: a + b = 20 + 10 = 30
- Updating
b: b *= 30 means b = b * 30 - So, b = 10 * 30 = 300.
print(a, b)The final values of the variables are:
- a = 20
- b = 300
Hence, the output of the program is:
20 300