Skip to content

Instantly share code, notes, and snippets.

@Zalasyu
Last active April 22, 2021 22:27
Show Gist options
  • Save Zalasyu/5e7929d5687c02136f4f253c7a529a44 to your computer and use it in GitHub Desktop.
Save Zalasyu/5e7929d5687c02136f4f253c7a529a44 to your computer and use it in GitHub Desktop.
Two files that simulate a calculator WITH __name__ == '__main__'
# 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()
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