Challenge 2: Implementing a Sports Team!
Explore how to design and implement classes representing a School, its Teams, and their Players to understand object relationships in Python. Learn to create properties, add methods for managing player and team lists, and calculate totals across objects. This lesson helps you practice structuring interconnected classes and handling data aggregation in an object-oriented way.
We'll cover the following...
We'll cover the following...
Problem statement
You have to implement 3 classes, School, Team, and Player, such that an instance of a School should contain instances of Team objects. Similarly, a Team object can contain instances of Player class.
Consider this diagram for clarification:
You have to implement a School class containing a list of Team objects and a Team class comprising a list of Player objects. ...