Skip to content

Instantly share code, notes, and snippets.

@ChaitanyaBaweja
Created December 21, 2018 11:14
Show Gist options
  • Save ChaitanyaBaweja/b0b2e50184653ffd058fcaabd4830dde to your computer and use it in GitHub Desktop.
Save ChaitanyaBaweja/b0b2e50184653ffd058fcaabd4830dde to your computer and use it in GitHub Desktop.
Applies function given by f to each element in L
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