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
answer is B
ReplyDeleteWhich question ???
DeleteIt is correct there is no answer b
ReplyDelete??
DeleteCan u please explain why for the last question the answer is name error? Won't the values get assigned simultaneously??
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )