## Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

# Get_moves() function in dungeon_game

Hi guys, I would appreciate it if someone could answer me the following question. As I am new to programming, my understanding so far is, that the body within an if-statement is only executed iff the condition of the if-statement is true, isn't?

In the dugeon_game we define the cells constant as follows:

CELLS = [(0, 0), (0, 1), (0, 2),(1, 0), (1, 1), (1, 2),(2, 0), (2, 1), (2, 2)]

ā¦ now we define the get_moves() function as follows:

***def get_moves(player): moves = ['LEFT', 'RIGHT', 'UP', 'DOWN']

if player[1] == 0: moves.remove('LEFT') if player[1] == 2: moves.remove('RIGHT') if player[0] == 0: moves.remove('DOWN') if player[0] == 2: moves.remove('UP') return moves***

So when we check if player[1] == 0 , we are actually checking the if (0,1) == 0 isn't like that? When will this be true?

Thanks for your help guys :-)

Cheers Urs