Q. Write the output of the following:

(a)

num1 = 4

num2 = num1 + 1

num1 = 2

print (num1, num2)


(b)

num1, num2 = 2, 6

num1, num2 = num2, num1 + 2

print (num1, num2)


(c)

num1, num2 = 2, 3

num3, num2 = num1, num3 + 1

print (num1, num2, num3)


Answer:-

Output:-
(a)
2 5

(b)
6 4

(c)
NameError: name 'num3' is not defined

5 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. It is correct there is no answer b

    ReplyDelete
  2. Can u please explain why for the last question the answer is name error? Won't the values get assigned simultaneously??

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post