the keys of the dicts will be the player names or their nicknames,e .g.
the values will be instances of class Player, e.g. with just first three players
You should know that everything in python is object. it doesn't matter if it is some built-in type or custom class - it can be value in a dict
If you don't plan to expand the class, built-in
am
(depending how you expect your user to provide the search term).the values will be instances of class Player, e.g. with just first three players
class Player: def __init__(self, full_name, goals, shots, headers, tackles, passes, clean_sheets): self.nm = full_name self.gl = goals self.st = shots self.hd = headers self.tk = tackles self.ps = passes self.cs = clean_sheets players = {'am':Player('Alfredo Morelos', 35, 10, 5, 5, 6, 10), 'rk':Player('Ryan Kent', 20, 10, 7, 5, 6, 8), 'jd':Player('Jermaine Defoe', 30, 6, 5, 5, 6, 8)}then you can access them as with normal dict, using the key
You should know that everything in python is object. it doesn't matter if it is some built-in type or custom class - it can be value in a dict
If you don't plan to expand the class, built-in
namedtuple
from collections
module would do just the same job.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs