-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFindFile.py
More file actions
29 lines (23 loc) · 794 Bytes
/
FindFile.py
File metadata and controls
29 lines (23 loc) · 794 Bytes
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
# homework tonight may be rough
# Task 1: get a year from user
# Ask for an input, set it to year
# Task 2: get a name from user
# Ask for a name
# Task 3: open file associated with that year
# need help with that
# Task 4: see how many times the name was used in the year
# have to split the comma character to get the seperate numbers for how many
# times
filename = "can't find is :("
# careful about male and female for a name, give an associated gender
f = open(filename)
line = f.readline()
while line:
items = line.split(",")
line_name = items [0]
line_sex = items [1]
line_uses = items [2]
if name == line_name:
print ("The name " + name + " was used " + \
line_uses + " in the year " + year + ".")
line = f.readline()