norminette ex06
This commit is contained in:
@@ -5,7 +5,8 @@ def ft_filter(function, iterable):
|
||||
Return an iterator yielding those items of iterable for which function(item)
|
||||
is true. If function is None, return the items that are true."""
|
||||
|
||||
# iter https://docs.python.org/3.10/library/functions.html?highlight=iter#iter
|
||||
# iter
|
||||
# https://docs.python.org/3.10/library/functions.html?highlight=iter#iter
|
||||
if function is None:
|
||||
return iter([item for item in iterable if item])
|
||||
else:
|
||||
|
||||
@@ -16,4 +16,4 @@ print("- 3 filter :", list(filter(None, msg)))
|
||||
print(" ft_filter :", list(ft_filter(None, msg)))
|
||||
|
||||
print("- 4 filter :", list(filter(str.isupper, msg)))
|
||||
print(" ft_filter :", list(ft_filter(str.isupper, msg)))
|
||||
print(" ft_filter :", list(ft_filter(str.isupper, msg)))
|
||||
|
||||
Reference in New Issue
Block a user