I want to use the return value with classes but I don't know how to make it automatic. Let's say I give enemy("e21") and it returns e21
I've tried replacing the return value with string but It didn't work with my class
# <-- means separate file (and they are imported)
def e_info(input1, monster):
if input1 == "name":
return monster.name
#
def enemy(input2):
if input2 == "e1":
return e1
if input2 == "e2":
return e2
#
print(2 * "\n" + e_info("name", m.enemy(enemy_info)))
#
class Enemy:
def __init__(self, name):
self.name = name
e1 = Enemy("Test1")