Created
June 4, 2018 06:16
-
-
Save raganmd/f54ea4d4412151a5483c44380b82d48b to your computer and use it in GitHub Desktop.
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 switcher(func_name, val1, val2): | |
if func_name == "Add": | |
result = Add(val1, val2) | |
elif func_name == "Subtract": | |
result = Subtract(val1, val2) | |
elif func_name == "Multiply": | |
result = Multiply(val1, val2) | |
elif func_name == "Divide": | |
result = Divide(val1, val2) | |
return result | |
def Add(val1, val2): | |
sum_val = val1 + val2 | |
return sum_val | |
def Subtract(val1, val2): | |
sum_val = val1 - val2 | |
return sum_val | |
def Multiply(val1, val2): | |
sum_val = val1 * val2 | |
return sum_val | |
def Divide(val1, val2): | |
sum_val = val1 / val2 | |
return sum_val | |
print( switcher("Subtract", 1, 2) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment