A dictionary holds the number of students who gave each main reason in a survey. You will find the share of each reason and the reason that was given most.
The idea. The share of a reason is its count divided by the total of all the counts, times 100.
Your tasks.
percent. It gives the per cent for one reason, to one decimal place.main_reason. It gives the reason with the largest count.shares. It gives a dictionary of the per cent for every reason.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…