You will count signals made from coloured flags in two ways: by listing them all with itertools.product, and by the multiplication principle. The checker tells you whether the two ways agree.
The idea. product(colours, repeat=2) gives every pair of colours, repeats included. A signal needs two different flags, so keep only the pairs whose two colours differ.
Your tasks.
listed to the number of pairs from product(colours, repeat=2) with two different colours.multiplied to the same count by the multiplication principle, using len(colours).pins to the number of -digit PINs with no digit used twice, by multiplying.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…
With Standard, you also open 12 more problems, 2 Python labs and 1 extra course. Everything you have used here stays free, always.