Skip to content

Instantly share code, notes, and snippets.

@FerdinaKusumah
Created December 5, 2019 01:26
Show Gist options
  • Save FerdinaKusumah/fc91cf8efac0508aaa2beba21a8d6a54 to your computer and use it in GitHub Desktop.
Save FerdinaKusumah/fc91cf8efac0508aaa2beba21a8d6a54 to your computer and use it in GitHub Desktop.
Chaining function call
"""Chain function call"""
def sum_product(a, b):
return a + b
def reduce_product(a, b):
return a - b
need_to_sum = True
a = 10
b = 4
c = (sum_product if need_to_sum is True else reduce_product)(a, b)
print(c)
# 14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment