CBSE Class 9 Computer Applications
Question 11 of 23
Introducing Python — Question 4
Back to all questions 4
Question Question 3(ii)
What will be the output produced by following code fragment ?
first = 2
second = 3
third = first * second
print first, second, third
first = first + second + third
third = second * first
print first, second, thirdOutput
2 3 6
11 3 33
Explanation
first = 2⇒ assigns an initial value of 2 to first.second = 3⇒ assigns an initial value of 3 to second.third = first * second⇒ third = 2 * 3 = 6. So variable third is initialized with a value of 6.print first, second, third⇒ prints the value of first, second, third as 2, 3 and 6 respectively.first = first + second + third⇒ first = 2 + 3 + 6 = 11third = second * first⇒ third = 3 * 11 = 33print first, second, third⇒ prints the value of first, second, third as 11, 3 and 33 respectively.