Report Bug

Qus

What is the list comprehension equivalent for?

  {x : x is a whole number less than 20, x is even}    (including zero)
Qusलिस्ट की काम्प्रीहेन्शन किसके लिए इक्विवलन्ट है?


A. [x for x in range(1, 20) if (x%2==0)]
B. [x for x in range(0, 20) if (x//2==0)]
C. [x for x in range(1, 20) if (x//2==0)]
D. [x for x in range(0, 20) if (x%2==0)]


Solution
D. [x for x in range(0, 20) if (x%2==0)]



Explanation
The required list comprehension will print a whole number, less than 20, provided that the number is even. Since the output list should contain zero as well, the answer to this question is: [x for x in range(0, 20) if (x%2==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