129. Python Program to Make a Class Attendance Report
HardWhich one?
Overview
Put the whole chapter together: tuples for records, sets to drop repeats, unpacking in a loop, and a dictionary to count.
Problem Statement
A teacher types who was in class: one line per student per day, a name and a day separated by a space, like Sunny Mon, until done. The same line may be typed twice by mistake; count it only once.
Print:
Days:and how many different days appear.- For every student, in A to Z order: the name and on how many of those days they were present, like
Lucky: 2 of 3 days. Every day:and the students present on every day, in A to Z order, joined with a comma and a space, ornobody.
For example:
Days: 3
Lucky: 2 of 3 days
Rocky: 3 of 3 days
Sunny: 3 of 3 days
Every day: Rocky, Sunny
If the first line is already done, print only:
No attendance
Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.
Input
One line per student per day; the last line is always done. Example:
Sunny Mon
Rocky Mon
Sunny Tue
Rocky Tue
Lucky Tue
Sunny Wed
Rocky Wed
Lucky Wed
done
Output
The output for that example:
Days: 3
Lucky: 2 of 3 days
Rocky: 3 of 3 days
Sunny: 3 of 3 days
Every day: Rocky, Sunny
The tests try 4 different inputs.