Programming and Problem Solving through Python : Sequence data types in python

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

Write the list comprehension to pick out only negative integers from a given list ‘l’.




Solution
D. [x for x in l if x<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<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].

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Exam Quiz Website development Company in Allahabad