Aggregation: Has-a relationship

Easy Composition & Aggregation
Solve in Playground →

Problem Statement

Implement a `Player` class and a `Team` class. The `Team` class takes an existing `Player` object via a method `add_player(player)`. Read a player name and team name, instantiate them separately, link them, and print ‘[player] joined [team]’.

Input Format

Two lines: Player name then Team name.

Output Format

Print the formatted joining message.

Constraints

None

Sample Input

Alice
Warriors

Sample Output

Alice joined Warriors

Explanation

Aggregation represents a weak 'has-a' relationship where the child object can exist independently of the parent.

Starter Code

class Player:
    pass

class Team:
    pass

if __name__ == '__main__':
    p_name = input().strip()
    t_name = input().strip()
    # Create objects and use aggregation
    pass

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used