-
Notifications
You must be signed in to change notification settings - Fork 0
/
ps9pr2.py
33 lines (26 loc) · 862 Bytes
/
ps9pr2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#
# ps9pr1.py (Problem Set 9, Problem 1)
#
# A Date Client
#
# name: Sarah Larbi
# email: slarbi@bu.edu
#
# Partner's Name: Sheryn Chung
# Partner's Emial: sherync@bu.edu
from ps9pr1 import Date
def print_birthdays(filename):
''' accepts a string filename as a parameter. The function should then open the file that corresponds to that filename, read through the file, and print some information derived from that file.
'''
file = open(filename, 'r')
for line in file:
line = line[:-1]
fields = line.split(',')
name = fields[0]
new_month = int(fields[1])
new_day = int(fields[2])
new_year = int(fields[3])
d = Date(new_month, new_day, new_year)
day = d.day_of_week()
print(name + ' ' + '(' + str(d) + ')' + ' ' + '(' + day + ')')
file.close()