Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Solution Review 2: Implementing a Sports Team!

Sumit Rawal answered on May 17, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • Challenge 2: Implementing a Sports Team!

  • Solution Review 2: Implementing a Sports Team!

    0

    Line 2 – 5: Defined initializer for Player

    Line 9 – 11: Defined initializer for Team, which also contains a list of players

    Line 13 – 14:getNumberOfPlayers() returns the length of the list, players

    Line 16 – 17: addPlayer() appends a Player object in the players list

    Line 21 – 23: Defined initializer for School, which also contains a list of teams

    Line 25 – 26: addTeam() appends a Team object in the teams list

    Line 28 – 32:getTotalPlayersInSchool returns the total number of players in the school by adding the length of all the players list in the teams list

    Line 35 – 38: Created four Player objects

    Line 40: Created a Team object, red_team.

    Line 41 – 42: Added two Player objects in the red_team's players list

    Line 44: Created a Team object, blue_team.

    Line 45 – 46: Added two Player objects in the blue_team's players list

    Line 48: Created a School object, mySchool.

    Line 49 – 50: Added two Team objects in the mySchool's teams list 

    Popularity 1/10 Helpfulness 1/10 Language python
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on May 17 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.