Report Bug

Qus

What will be the output of the following Python code?

  l1=[10, 20, 30]  l2=[-10, -20, -30]  l3=[x+y for x, y in zip(l1, l2)]  l3
Qusनिम्नलिखित Python कोड का आउटपुट क्या होगा?


A. Error
B. 0
C. [-20, -60, -80]
D. [0, 0, 0]


Solution
D. [0, 0, 0]



Explanation
The code shown above returns x+y, for x belonging to the list l1 and y belonging to the list l2. That is, l3=[10-10, 20-20, 30-20], which is, [0, 0, 0].
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