-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrsa_data.py
More file actions
executable file
·25 lines (22 loc) · 789 Bytes
/
Copy pathrsa_data.py
File metadata and controls
executable file
·25 lines (22 loc) · 789 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
#!/usr/bin/python3
def find_details(id2find):
result = None
rsa_data = open("surfing_data.csv")
for line in rsa_data:
surfer = {}
(surfer['id'], surfer['name'], surfer['country'], surfer['average'], surfer['board'], surfer['age']) = line.split(";")
if id2find == int(surfer['id']):
result = surfer
rsa_data.close()
return(result)
lookup_id = int(input("Enter the id of the surfer: "))
surfer = find_details(lookup_id)
if surfer:
print("ID: " + surfer['id'])
print("Name: " + surfer['name'])
print("Country: " + surfer['country'])
print("Average: " + surfer['average'])
print("Board: " + surfer['board'])
print("Age: " + surfer['age'])
else:
print("Could not find the surfer")