Skip to content

Instantly share code, notes, and snippets.

@saulcosta
Created May 6, 2019 16:14
Show Gist options
  • Save saulcosta/ef3e3801ca5c82188a1039d84ada60bb to your computer and use it in GitHub Desktop.
Save saulcosta/ef3e3801ca5c82188a1039d84ada60bb to your computer and use it in GitHub Desktop.
Example calculator Python script.
def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
return x / y
if __name__ == '__main__':
x = int(input('Please enter a number: '))
y = int(input('Please enter another number: '))
print(add(x, y))
print(subtract(x, y))
print(multiply(x, y))
print(divide(x, y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment