⚔️
CODE QUEST
Quests
Skill Tree
Saves
Sign In
spell_editor.py
Back to Path
class Hero: def __init__(self, name, level, spells): self.name = name self.level = level self.spells = spells def __str__(self): # Should return: "Pyrion (Level 5)" ??? def __len__(self): # Should return the number of spells ??? def __eq__(self, other): # Two heroes are equal if they have the same name and level ??? pyrion = Hero("Pyrion", 5, ["Fireball", "Shield", "Haste"]) zeph = Hero("Zeph", 5, ["Ice Bolt"]) print(str(pyrion)) # Pyrion (Level 5) print(len(pyrion)) # 3 print(pyrion == zeph) # False print(pyrion == Hero("Pyrion", 5, [])) # True
Save Completion