Skip to content

Commit d9959a0

Browse files
author
Anastomose
committed
mailroom updates
1 parent 0859d1d commit d9959a0

1 file changed

Lines changed: 26 additions & 25 deletions

File tree

‎Students/ebuer/session_03/mailroom.py‎

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,32 @@
33
import random
44

55
def rd():
6-
return round(random.random() * 100,2)
6+
return round(random.random() * 100, 2)
77

88
#this may be a bad idea but we will see, a list of tuples for clients
99
client_list = [
10-
('Askew', 'Anne'),\
11-
('Bocher', 'Joan'),\
12-
('Clarkson', 'Jeremy'),\
13-
('Hamont', 'Matthew'),\
14-
('May', 'James'),\
15-
('Parris', 'George van')
16-
]
17-
18-
donations = [
19-
(client_list[0], rd(), rd(), rd()),
20-
(client_list[1], rd(), rd()),
21-
(client_list[2], rd(), rd(), rd()),
22-
(client_list[3], rd(), rd(), rd(), rd()),
23-
(client_list[4], rd(), rd(), rd()),
24-
(client_list[5], rd(), rd(), rd())
25-
]
26-
27-
for c in client_list:
28-
for d in donations:
29-
if d[0] == c:
30-
temp_dontation = d[1:]
31-
32-
print "Hello {first} {last}, thanks for donating ${value}"\
33-
.format(last = c[0], first= c[1], value=temp_dontation[0])
10+
(('Askew', 'Anne'), (rd(), rd(), rd())),
11+
(('Bocher', 'Joan'), (rd(), rd())),
12+
(('Clarkson', 'Jeremy'), (rd())),
13+
(('Hamont', 'Matthew'), (rd(), rd(), rd())),
14+
(('May', 'James'), (rd(), rd())),
15+
(('Parris', 'George van')] (rd(), rd(), rd()))]
16+
17+
18+
19+
20+
21+
22+
23+
24+
#take a name and check the list
25+
def client_check(nme, client_list):
26+
fname, lname = nme.split(' ')
27+
if (lname, fname) in client_list:
28+
print '{f} {l} is a previous donor.'.format(f=fname, l=lname)
29+
return True
30+
else:
31+
print '{f} {l} is a not a previous donor.'.format(f=fname, l=lname)
32+
return False
33+
34+
res=client_check('Annie Askew', client_list)

0 commit comments

Comments
 (0)