forked from ta-data-lis/python-project
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhighscore.py
More file actions
26 lines (20 loc) · 734 Bytes
/
highscore.py
File metadata and controls
26 lines (20 loc) · 734 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
import time
import pandas as pd
def Timerfuntion(Timer, start_time=time.time()):
"""Starting a timer"""
if Timer == "start game":
return time.time()
elif Timer == "end game":
#Total = time.time() - start_time
return int(time.time() - start_time)
# return f"Congratulations you finnished in {int(Total)} seconds"
def load_dataframe():
score = pd.read_csv("Highscores.csv", delimiter=",")
return score
def add_record(user, time):
score = load_dataframe()
score.loc[len(score.index)] = [user, time]
score.sort_values(by=['points'], ascending=True, inplace=True)
score.to_csv("Highscores.csv", index=False)
print("\n\nless points the better")
print(score)