Skip to content

Instantly share code, notes, and snippets.

@techstackmedia
Created September 19, 2019 14:20
Show Gist options
  • Select an option

  • Save techstackmedia/b0de7dda78ab504d044369bd981f5ad7 to your computer and use it in GitHub Desktop.

Select an option

Save techstackmedia/b0de7dda78ab504d044369bd981f5ad7 to your computer and use it in GitHub Desktop.
# Python as calculator
x, y = 9, 3
print(x + y) # Addition
# 12
print(x - y) # Subtraction
# 6
print(x * y) # Multiplication
# 27
print(x / y) # Subtraction - Same as float(x / y)
# 3.0
print(x // y) # Floor - Same as int(x / y)
#3
print(x % y) # Reminder
# 0
print(x ** y) # Exponential - Same as pow(x, y)
# 729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment