I am attempting to create a child object from random variables within a list. I have included all code that I have tried. Googling the errors brings up many posts and solutions, none of which seem to be exactly parallel enough for me to utilize. Thanks for your time and consideration.
import random
class Monster:
def __init__(self, name, level):
self.name = name
self.level = level
class Dragon(Monster):
def breathe_fire(self):
print("The Dragon breathes fire!")
class Skeleton(Monster):
def strikes(self):
print("The Skeleton strikes with its sword!")
MONSTERS = ["Skeleton", "Dragon"]
monster_type = random.choice(MONSTERS)
monster_level = 1
monster_stats = [monster_type, monster_level]
print(monster_stats)
# create object from child class and pass stats
#monster = random.choice(MONSTERS(*monster_stats)) <--'list' object is not callable
#monster = Dragon(*monster_stats) # <-- works, but is useless for my purposes
#monster = monster_type(*monster_stats) <--- 'str' object is not callable