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 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz