You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: slides_sources/source/exercises/mailroom.rst
+16-6Lines changed: 16 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Goal:
14
14
15
15
You work in the mail room at a local charity. Part of your job is to write
16
16
incredibly boring, repetitive emails thanking your donors for their generous
17
-
gifts. You are tired of doing this over an over again, so yo've decided to
17
+
gifts. You are tired of doing this over an over again, so you've decided to
18
18
let Python help you out of a jam.
19
19
20
20
The program
@@ -26,8 +26,8 @@ Write a small command-line script called ``mailroom.py``. This script should be
26
26
history of the amounts they have donated. This structure should be populated
27
27
at first with at least five donors, with between 1 and 3 donations each
28
28
29
-
* The script should prompt the user (you) to choose from a menu of 2 actions:
30
-
'Send a Thank You' or 'Create a Report'.
29
+
* The script should prompt the user (you) to choose from a menu of 3 actions:
30
+
'Send a Thank You' or 'Create a Report' or 'quit')
31
31
32
32
Sending a Thank You
33
33
-------------------
@@ -38,7 +38,7 @@ Sending a Thank You
38
38
* If the user types a name not in the list, add that name to the data structure and use it.
39
39
* If the user types a name in the list, use it.
40
40
* Once a name has been selected, prompt for a donation amount.
41
-
* Verify that the amount is in fact a number, and re-prompt if it isn't.
41
+
* Turn the amount into a number -- it is OK at this point for the program to crash if someone types a bogus amount.
42
42
* Once an amount has been given, add that amount to the donation history of
43
43
the selected user.
44
44
* Finally, use string formatting to compose an email thanking the donor for
@@ -50,10 +50,10 @@ Sending a Thank You
50
50
Creating a Report
51
51
------------------
52
52
53
-
* If the user (you) selected 'Create a Report' Print a list of your donors,
53
+
* If the user (you) selected 'Create a Report' print a list of your donors,
54
54
sorted by total historical donation amount.
55
55
56
-
- Include Donor Name, total donated, number of donations and average donation amount as values in each row.
56
+
- Include Donor Name, total donated, number of donations and average donation amount as values in each row. You do not need to print out all their donations, just the summary info.
57
57
- Using string formatting, format the output rows as nicely as possible. The end result should be tabular (values in each column should align with those above and below)
58
58
- After printing this report, return to the original prompt.
59
59
@@ -62,6 +62,16 @@ Creating a Report
62
62
63
63
* From the original prompt, the user should be able to quit the script cleanly
64
64
65
+
66
+
Your report should look somethign like this::
67
+
68
+
Donor Name | Total Given | Num Gifts | Average Gift
0 commit comments