forked from IEEE-VIT/Haunted_House
-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaderboard.py
46 lines (35 loc) · 1000 Bytes
/
leaderboard.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
34
35
36
37
38
39
40
41
42
43
44
import csv
class Leaderboard:
def __init__(self, filename="lb.csv"):
self.filename = filename
self.data = []
'''
Write the load function,
it should read the data in the csv file,
and append a dictionary of {name, score} in the list - data
'''
def load(self):
self.data = []
#write your code here
pass
'''
Write the save function that saves all the scores to the CSV file
in highest to lowest scores.
'''
def save(self):
#write your code here
pass
'''
Write the update function,
if the player already exists in the file then update the higher score
else add a new row to the end of the file with name and score as columns
'''
def update(self, player_name, player_score):
self.load()
#write your code hear
self.save()
'''
Display the scores of each and every person in the leaderboard
'''
def display(self):
pass