Skip to content
Advertisement

Don’t understand why my function can’t be called

I try to make a little text based rpg with python. And the first thing that I want to make is an input to equip armor or weapons.

JavaScript

So here is the problem:

my function find_armor is not calling whatever I enter.

If my first word is “equip” the output is always: your armor: 0 0

Advertisement

Answer

In a function, variables change with local scope. Then use global armor before. And fixing the bad indentation:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement