Learn

An enumeration is defined as the number of ways to select from, or arrange, a set of n objects. Before we can begin studying this process, we have to explore some fundamental concepts.

Let’s say you have two different sets of objects (here, by “set” we mean the mathematical definition of a set), and you want to figure out how many different ways you can pick one object from either set. Set A has ten objects in it and set B has five objects in it. You can either pick one object from set A or one object from set B. The total number of possible objects that you can have is simply the sum of the number of objects in set A and set B, so the answer is 15. This is known as the addition principle.

Let’s say, however, you wish to pick an object from set A and set B. For every option from set A, you have an option from set B. This means the number of ways of selecting one object from set A and one object from set B is the product of the number of objects in two sets. In this case, the answer is 10(5) = 50. This is known as the multiplication principle.

As a general rule:

  • If you find yourself saying “or,” you have to add.
  • If you find yourself saying “and” or “for every,” you have to multiply.

Instructions

1.

If someone has a box of five fruits and another box of four bags of chips and they want to pick one snack from either box for a train ride, how many options for a snack do they have? Set the variable checkpoint_1 to your answer.

2.

Let’s say a person wants to take one fruit and one bag of chips for the train ride. How many ways can they do this? Assign your answer to the checkpoint_2 variable.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?