Report Bug

Qus

What will be the output of the following Python code?

def unpack(a,b,c,d):
    print(a+d)
x = [1,2,3,4]
unpack(*x)
Qus

निम्नलिखित Python कोड का आउटपुट क्या होगा?

def unpack(a,b,c,d):
    print(a+d)
x = [1,2,3,4]
unpack(*x)


A. Error
B. [1,4]
C. [5]
D. 5


Solution
D. 5



Explanation
unpack(*x) unpacks the list into the separate variables. Now, a=1 and d=4. Thus 5 gets printed.
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad