Last active
April 22, 2021 22:27
-
-
Save Zalasyu/5e7929d5687c02136f4f253c7a529a44 to your computer and use it in GitHub Desktop.
Two files that simulate a calculator WITH __name__ == '__main__'
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
# This script simulates a primitve calculator | |
def multiply(num_1, num_2): | |
"""Returns the product of two numbers""" | |
return num_1 * num_2 | |
def add(num_1, num_2): | |
"""Returns the sum of two numbers""" | |
return num_1 + num_2 | |
def main(): | |
print('Calc.py was ran as a script!') | |
result = multiply(3, 5) | |
print(f'Here is your result {result}') | |
if __name__ == '__main__': | |
main() |
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
import calc | |
print('Calc.py was imported but not ran as a script!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment