3. modulus & exponents

Last video we went over some more common operators, but this time we’re going slightly more obscure with modulus and exponents. But don’t worry, we’ll be giving you plenty of practice and by the end of this video you’ll be just as familiar with these 2 new operators as addition, subtraction, multiplication, and division!

agenda

  • review operators
  • what is modulus
  • what are exponents?
  • practice!

slides worksheet 16 min
more practice
question #1

How can you check if a number is divisible by another number in python?


Take the first number % the second number. If the result is 0, the first number is divisible by the second number.

question #2

Given the side length of a cube is 3 inches, write a line of code to output the volume of the cube (Hint: the volume of a cube is its side length multiplied by itself 3 times)


print(3**3)

or

print(3 * 3 * 3)