filter list with python
scores = [70, 60, 80, 90, 50]
filtered = filter(lambda score: score >= 70, scores)
print(list(filtered))
# Output:
[70, 80, 90]
filter list with python
scores = [70, 60, 80, 90, 50]
filtered = filter(lambda score: score >= 70, scores)
print(list(filtered))
# Output:
[70, 80, 90]
filter function in python
# filter is just filters things
my_list = [1, 2, 3, 4, 5, 6, 7]
def only_odd(item):
return item % 2 == 1 # checks if it is odd or even
print(list(filter(only_odd, my_list)))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us