Created
December 21, 2018 11:14
-
-
Save ChaitanyaBaweja/b0b2e50184653ffd058fcaabd4830dde to your computer and use it in GitHub Desktop.
Applies function given by f to each element in L
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def apply(L, f): | |
""" | |
Applies function given by f to each element in L | |
Parameters | |
---------- | |
L : list containing the operands | |
f : the function | |
Returns | |
------- | |
result: resulting list | |
""" | |
result = [] | |
for i in range(len(L)): | |
result.append(f(L[i])) | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment