Math functions

PHOTO EMBED

Sun Jan 30 2022 06:27:33 GMT+0000 (Coordinated Universal Time)

Saved by @marcpio

# floor division operator, //, divides two numbers and rounds down to an integer
135 // 60
>> 2

# modulus operator, %, divides two numbers and returns remainder
135 % 60
>> 15

# Applications of modulus operator:
# if (x % y ) is zero, then x is divisible by y
# extract right-most digit(s) from number: e.g., x % 10 extracts right-most digit of x (in base 10); similarly x % 100 yields last two digits

# 1e-15 is Python notation for 10**(-15)
content_copyCOPY