Horje
Python Filter List with Lambda Code Example
Python Filter List with Lambda
# creating a list in Python
mylist= [3,5,1,5,7,8,2,6]

#filter all the odd numbers using list Comprehension
result = [x for x in mylist if x%2!=0]
print('The odd numbers are ',list(result))


#filter all the even numbers using list Comprehension
result = [x for x in mylist if x%2==0]
print('The even numbers are ',list(result))




Python

Related
gridsearch cv Code Example gridsearch cv Code Example
send dm to user discord.py Code Example send dm to user discord.py Code Example
django check if get parameter exists Code Example django check if get parameter exists Code Example
install python windows powershell Code Example install python windows powershell Code Example
opencv resize image Code Example opencv resize image Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7