I hereby claim:
- I am reeddunkle on github.
- I am reeddunkle (https://keybase.io/reeddunkle) on keybase.
- I have a public key ASCm2gw-AtqWXibjXoD53MAUkYJSEBVVE6526_lKxxUPgQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| def my_filter(function, iterable): | |
| output = [] | |
| for item in iterable: | |
| if function(item): | |
| output.append(item) | |
| return output |
| >>> string = "Reed Dunkle" | |
| >>> string.startswith('Reed D') | |
| True | |
| >>> string.startswith('Re') | |
| True | |
| >>> string.startswith('Reed W') | |
| False | |
| >>> |
| >>> tuple = ('fashion', 'nugget') | |
| >>> tuple[0] | |
| 'fashion' | |
| >>> tuple[1] | |
| 'nugget' | |
| def my_filter(function, iterable): | |
| output = [] | |
| for item in iterable: | |
| if function(item): | |
| output.append(item) | |
| return output |
| def my_map(function, iterable): | |
| output = [] | |
| for element in iterable: | |
| result = function(element) | |
| output.append(result) | |
| return output |
| FILES = ["picture1", "georgi_paws_everywhere", "custom_wreath"] | |
| def my_map(function, iterable): | |
| output = [] | |
| for element in iterable: | |
| result = function(element) | |
| output.append(result) |
| NUMBERS = range(4) | |
| NAMES = ['Rebecca', 'Georgi', 'Reed', 'Thom Yorke'] | |
| def my_map(function, iterable): | |
| output = [] | |
| for element in iterable: | |
| result = function(element) |
| FILES = ["picture1", "georgi_paws_everywhere", "custom_wreath"] | |
| results = ["{}.jpg".format(file) for file in FILES] | |
| print results | |
| ''' | |
| This is hacky and ugly. It only works because both | |
| lists are the same size, etc. etc. | |
| Upon researching this, it seems that this is an example | |
| when map() is actually way better and preferable. | |
| There's also a function called zip() which does this, | |
| but I haven't learned zip() yet. |