Created
July 28, 2020 13:23
-
-
Save FerdinaKusumah/3d59fb5dcf186d3fab9c27f4111502c8 to your computer and use it in GitHub Desktop.
[Python] Chain function Call
This file contains hidden or 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
"""Chain function call""" | |
def sum_number(x: int, y: int) -> int: | |
return x + y | |
def sub_number(x: int, y: int) -> int: | |
return x - y | |
need_to_sum = True | |
a = 10 | |
b = 4 | |
c = (sum_number if need_to_sum is True else sub_number)(a, b) | |
# 14 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment