Learn

So far, you have learned many techniques to enumerate members of a set. Well done! In a real-world problem, however, arranging or selecting from a set of items may not be so straightforward. A single enumeration problem may require you to consider many different possible situations. It is because of this, some enumeration problems are solved by breaking the problem down into subcases, enumerating those using techniques from previous exercises, and then combining the results by using the addition principle, the multiplication principle, or any combination of the two.

Consider this example: vehicles registered in the state of New York are issued license plates that consist of three letters followed by a four-digit number. How many different license plates can be issued to cars registered in New York? To solve this problem, we can break it down into two subproblems. Namely, we want the number of ways to pick three letters AND the number of ways to pick a four-digit number. We can pick any three letters in 26 3 ways to get 17,576 possible arrangements of letters. Then we can pick any four-digit number in 104 ways to get 10,000 possible arrangements of four-digit numbers. We then multiply the two numbers to get 175,760,000 possible license plates.

Instructions

1.

Given a four-letter string composed of English letters and containing exactly one C and one M, how many ways are there to place the one C in the string? Assign your answer to the variable num_ways_c.

2.

Now, how many ways can you place the one M? Assign your answer to the variable num_ways_m.

3.

Excellent! You have so far placed one C and one M. What about the remaining letters? Assign your answer to the variable num_ways_remaining.

4.

So, how would you combine your previous three answers to find the number of ways to arrange a four-letter string such that you have exactly one C and one M? Assign your answer to the variable total_num_ways.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?