Untitled
Anonymous
Plain Text
09/22/2025 5:34 AM
3.2 KB
18
Indexable
Never
class Manager:
def __init__(self, id, first_name, last_name, team):
self.id = id
self.first_name = first_name
self.last_name = last_name
self.team = team
def has_id(self, id):
return self.id == id
def use(self, league):
while True:
print("Manager Dashboard")
print("I) Information")
print("S) Assign manager")
print("W) Withdraw")
print("M) Manage team")
print("X) Logout")
raw = input("Choice: ")
choice = raw.strip().upper()
if choice == "I":
print("Information")
elif choice == "S":
print ("Assign manager")
elif choice == "W":
print ("Withdraw")
elif choice == "M":
print ("Manage team")
elif choice == "X":
return
if choice == "I":
if self.team is None:
team_txt = "None"
else:
team_txt = f"{self.team.local_name} {self.team.team_name}"
print(f"ID: {self.id}")
print(f"Name: {self.first_name} {self.last_name}")
print(f"Team: {team_txt}")
elif choice == "S":
options = league.teams.get_manageable_teams()
if not options:
print("No teams are currently available to manage, try again later!")
continue
print("Non-managed teams:")
for i, t in enumerate(options, start=1):
print(f"{i}. {t.get_local_name()} {t.team_name})
sel = input("Enter your chosen number: ").strip()
if not sel.isdigit():
print("Please choose a number from the list.")
continue
idx = int(sel) - 1
if not (0 <= idx < len(options)):
print("The number you entered is not listed")
continue
target = options[idx]
if self.team is not None:
print(f"You will be missed at {self.team.get_local_name()}!")
self.team.set_manager(None)
target.set_manager(self)
self.assign_team(target)
print(f"You've been successfully assigned to {target.get_local_name()} {target.team_name})
elif choice == "W":
if self.team is None:
print("You are not managing a team.")
else:
print(f"Are you sure you want to withdraw from {self.team.get_local_name()} {self.team.team_name})
self.team.set_manager(None)
self.assign_team(None)
elif choice == "M":
if self.team is None:
print("You must select a team first.")
else:
self.team.use(league)
elif choice == "X":
return
else:
print("Invalid choice!")
def assign_team(self, team):
self.team = teamEditor is loading...
Leave a Comment