class Squad: playerCount=0 def __init__(self,name,squadType): self.name = name self.squadType = squadType def formSquad(self): if Squad.playerCount >= 5: return True else: return False def __str__(self): s = f"{self.name} is a {self.squadType} team.\n" s+= f"Number of players in {self.name} is {Squad.playerCount}\n" return s class HogwartsQuidditchSquad(Squad): team_lst=[] playerCount = 0 def __init__(self,name,type): super().__init__(name,type) #self.name2=name2 def addPlayer(self,*args): strin1=list(args) for i in args: HogwartsQuidditchSquad.playerCount+=1 HogwartsQuidditchSquad.team_lst.append(i) def formSquad(self): if HogwartsQuidditchSquad.playerCount == 5: s="We have enough players to form a squad.\nBut we cannot form a perfect squad" return print(s) elif HogwartsQuidditchSquad.playerCount < 5: s="We do not have enough players to form a squad." return print(s) elif HogwartsQuidditchSquad.playerCount > 5: s="We have enough players to form a squad.\nso we can form a perfect squad!!" return print(s) def __str__(self): initial=f"{self.name} is a{self.squadType} team\nNumber of players in {self.name} is {len(HogwartsQuidditchSquad.team_lst)}\nThe player are\n" final_stirn='' for i in HogwartsQuidditchSquad.team_lst: final_stirn+=f'{i[1]}: \nPlayer name: {i[0]} House:{i[2]}\n' return initial+final_stirn #Write your code here # Do not change the following lines of code. f = HogwartsQuidditchSquad("Hogwart's Dragons","Quidditch") f.addPlayer(["Harry Potter","Seeker","Gryffindor"],["Katie Bell","Chaser","Gryffindor"]) print("1.====================================") print(f) print("2.====================================") f.formSquad() print("3.====================================") f.addPlayer(["Vincent Crabbe","Beater","Slytherin"]) f.addPlayer(["Miles Bletchley","Keeper","Slytherin"]) print("4.====================================") print(f) print("5.====================================") f.formSquad() print("6.====================================") f.addPlayer(["Ethan Humberstone","Keeper","Hufflepuff"]) f.formSquad() print("7.====================================") f.addPlayer(["Fred Weasley","Beater","Gryffindor"]) print(f) print("8.====================================") f.formSquad()