Files
jps/python/simple_math.py

31 lines
412 B
Python
Raw Permalink Normal View History

2020-02-25 14:05:06 -06:00
a = 9
b = 7
# ADD 2 NUMBERS
print(a + b)
# MULTIPLY 2 NUMBERS
c = a * b
print(c)
# DIVIDE 2 NUMBERS
d = a / b
print (d)
# INTEGER DIVISION
e = a // b
print(e)
# EXPONENT: b squared
print(b ** 2)
# MODULUS - remainder of a division
print(b % 3)
print(a % 4)
# EVEN? OR ODD - USE MOD
print(a % 2 == 0)
print(14 % 2 == 0)
# single = sign is for assigning a value to a variable
# double == is for comparisons