Skip to content

Instantly share code, notes, and snippets.

@vkuberan
Last active December 29, 2020 06:22
Show Gist options
  • Save vkuberan/58563bb41262994010053d357ae0f49a to your computer and use it in GitHub Desktop.
Save vkuberan/58563bb41262994010053d357ae0f49a to your computer and use it in GitHub Desktop.
# Right Implementation
def cubed(n):
return [(x * x * x) for x in n]
# Wrong Implementation and it will trigger an error
def postive_to_negative(n, j):
return [(x * x * x) for x in n]
numbers = [1, 2, 3, 4, 5]
print(high_order_func_demo(cubed, numbers))
print(high_order_func_demo(postive_to_negative, numbers))
# Print
# [1, 8, 27, 64, 125]
# : postive_to_negative() missing 1 required positional argument: 'j'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment