-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
25 lines (21 loc) · 704 Bytes
/
main.py
File metadata and controls
25 lines (21 loc) · 704 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
from hashtable import HashTable
import csv
if __name__ == "__main__":
ht = HashTable(30)
"""
1. Extract the records from the student_data file
and add them one at a time, as a Python dict,
containing the name, class and their associated
data as key-value dict pairs, to the hashtable
2. You can use the id as the hash table key for
each of the above records.
"""
# Test your hashtable using appropriate methods
# from your implementation
with open('student_data.csv') as f:
reader = csv.DictReader(f)
for row in reader:
key = row['id']
ht.setitem(key, row)
print(ht.__repr__)
#f.close()