You will write three small functions that search a dictionary of moons.
The idea. Each moon in the dictionary has the planet it goes round and its width in km. A program can count, compare and pick out moons for you.
Your tasks.
count_moons, return how many moons in the dictionary go round planet.widest, return the name of the widest moon in the dictionary.wider_than, return a list of the names of the moons wider than width km, in the order of the dictionary.Run your code once to unlock the worked solution.
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…