Skip to content

Commit 5cd06a1

Browse files
author
meshmote
committed
Added, debugged email print function
1 parent ea84b0b commit 5cd06a1

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎Students/RPerkins/session03/mailroom.py‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,29 @@ def in_dbase(i_name, tar_dbase):
4242
return True
4343
return False
4444

45+
def print_email(p_name, p_donation):
46+
""" Print thank you not for donation from p_name """
47+
print 'Dear %s, Thanks so much for your generous donation of $%s. It is greatly appreciated!' % (p_name, p_donation)
4548

4649
def app_record(app_name, app_dbase):
4750
""" Append an existing record with new donations """
4851
for i in range(len(app_dbase)):
4952
if app_name in app_dbase[i]:
50-
app_dbase[i].append(get_donation())
53+
app_donation = get_donation()
54+
app_dbase[i].append(app_donation)
55+
print_email(app_name, app_donation)
5156
break
5257
# print app_dbase
5358

5459
def add_record(add_name, add_dbase):
5560
""" Call get_donation and add new donor to database with result """
56-
new = [add_name, get_donation()]
61+
add_donation = get_donation()
62+
new = [add_name, add_donation]
5763
add_dbase.append(new)
64+
print_email(add_name, add_donation)
5865
# print '--in add_record--', add_dbase
5966

67+
6068
def thank_you(dbase):
6169
""" Find or create a donor, add new donation, and return a thank you note"""
6270
name = 'list'
@@ -66,7 +74,7 @@ def thank_you(dbase):
6674
if not (name == 'list'):
6775
break
6876
else:
69-
for i in range(len(dbase)-1):
77+
for i in range(len(dbase)):
7078
print dbase[i][0]
7179

7280
if in_dbase(name, dbase):
@@ -77,7 +85,6 @@ def thank_you(dbase):
7785
add_record(name, dbase)
7886
# print 'in thank_you, returning from add_record--', dbase
7987

80-
8188
def mk_report():
8289
""" Create a sorted list of donors"""
8390
print 'Report'

0 commit comments

Comments
 (0)