Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a2195fd

Browse files
Create 09_filter().MD
1 parent d5bae25 commit a2195fd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎Lecture_17/09_filter().MD

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# **`filter()`**
2+
3+
Creates a collection of element from an iterable for which a function return true.
4+
5+
**Syntax:** `filter(function, iterable)`
6+
7+
```py
8+
friends = [("Rachel", 20), ("Monica", 42), ("Richard", 19), ("Phoebe", 22), ("Ross", 23), ("Joey", 24)]
9+
age = lambda data : data [1] >= 18
10+
drinkingBuddies = list(filter(age, friends))
11+
for i in drinkingBuddies:
12+
print(i)
13+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /