-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFootball player's carreer.py
50 lines (46 loc) · 1.41 KB
/
Football player's carreer.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
45
46
47
48
49
50
from time import sleep
def line():
print('~' * 30)
players = dict()
team = list()
matches = list()
while True:
players.clear()
players['name'] = input("Player's name: ")
matchesp = int(input(f"How many matches did {players['name']} played? "))
for c in range(0, matchesp):
matches.append(int(input(f"How many goals at the match number {c+1}? ")))
players['goals'] = matches[:]
players['mplayed'] = matchesp
players['tgoals'] = sum(players['goals'])
team.append(players.copy())
matches.clear()
breaker = str(input('Any more players? [space(y)/(n)]'))
if breaker == 'n':
break
line()
print(f"{'Table of results':.^28}")
line()
print('Code', end='')
for i in players.keys():
print(f'{i:<15}', end='')
print()
for k, v in enumerate(team):
print(f"\n{k:>3}", end='')
for i in v.values():
print(f"{str(i):<15}", end='')
print()
while True:
line()
search = int(input("Search for a player if you want('999' to end): "))
if search == 999:
print('<End of the code>')
break
elif search > len(team):
print('There is no player with this number')
else:
print(f"Player n°{search}, {team[search]['name']}")
for k, v in enumerate(team[search]['goals']):
print(f'At the match {k}, made {v} goal(s)')
sleep(0.5)
# Not self-made :(