How to calculate arithmetic in python programming
x = 15
y = 4
# Output: x + y = 19
print('x + y =',x+y)
# Output: x - y = 11
print('x - y =',x-y)
# Output: x * y = 60
print('x * y =',x*y)
# Output: x / y = 3.75
print('x / y =',x/y)
# Output: x // y = 3
# Divides the number on its left by the number on its right, rounds down the answer, and returns a whole number.
print('x // y =',x//y)
# Output: x % y = 3
# Returns the remainder of dividing two numbers.
print('x % y =',x%y)
# Output: x ** y = 50625
print('x ** y =',x**y)
Comments
Leave a comment