-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUser.py
35 lines (26 loc) · 897 Bytes
/
User.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
class User:
def __init__(self, username: str, greatest_score=None, played_games: int = 0, nbfail: int = 0,
nbwin: int = 0) -> None:
if greatest_score is None:
greatest_score = []
self.username = username
self.greatest_score = greatest_score
self.played_games = played_games
self.nbfail = nbfail
self.nbwin = nbwin
def tostring(self):
return f" User {self.username} has {self.nbfail} fails et {self.nbwin} wons"
def getusername(self):
return self.username
def getplayedgames(self):
return self.played_games
def getgreatestscore(self):
return self.greatest_score
def getnbwin(self):
return self.nbwin
def getnbfail(self):
return self.nbfail
def add_win(self):
self.nbwin += 1
def add_fail(self):
self.nbfail += 1