This maybe a stupid question but I'm having trouble finding the answer.
I'm using Flask/Python and have a .py file named 'hero.py' that contains a dict ex.
heroes = {'ironman': 'Strength, Covert', 'IronFist': 'Tech, Strenght'}
def hero():
hero, attribute = random.choice(list(heroes.items()))
if 'Tech' not in attribute:
hero, attribute = random.choice(list(heroes.items()))
if 'Tech' in attribute:
return(hero, attribute)
What I'm wondering is how to use just the attribute
variable when I call the function?
I can do something like:
my_hero = hero()
print(my_hero)
But how do I print out only the attribute of that hero? Hopefully that makes sense?