filter pattern in 1.1.3

This commit is contained in:
Eric Douglas 2014-05-22 19:22:13 -03:00
parent 4570e40f5c
commit ef234d5e75
2 changed files with 10 additions and 0 deletions

View File

@ -51,4 +51,14 @@ def find(target, items):
return True
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