mirror of
https://github.com/ossu/computer-science.git
synced 2025-07-03 02:36:57 -04:00
filter pattern in 1.1.3
This commit is contained in:
parent
4570e40f5c
commit
ef234d5e75
2 changed files with 10 additions and 0 deletions
Binary file not shown.
|
@ -51,4 +51,14 @@ def find(target, items):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# The extreme pattern
|
||||||
|
largest = items[0]
|
||||||
|
for i in range(1, len(items), 1): # start comparing at index 1
|
||||||
|
if items[i] > largest:
|
||||||
|
largest = items[i]
|
||||||
|
|
||||||
|
# The filter pattern
|
||||||
|
def extractEvens(items):
|
||||||
|
for i in range(0, len(items), 1):
|
||||||
|
if (isEven(items[i])):
|
||||||
|
evens = evens + [items[i]] # array concatenation
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue