Report Bug

QusWrite the list comprehension to pick out only negative integers from a given list ‘l’. Qusदी गई लिस्ट। L ’से केवल नेगटिव इन्टिजर निकालने के लिए लिस्ट की समझ लिखें।


A. [x<0 in l]
B. [x for x<0 in l]
C. [x in l for x<0]
D. [x for x in l if x<0]


Solution
D. [x for x in l if x&lt;0]



Explanation

To pick out only the negative numbers from a given list ‘l’, the correct list comprehension statement would be: [x for x in l if x&lt;0].

For example if we have a list l=[-65, 2, 7, -99, -4, 3]
>>> [x for x in l if x<0]
The output would be: [-65, -99, -4].

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 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 Best Website and Software Company in Allahabad