Python Python Collections (2016, retired 2019) Dungeon Game Hit points

Vashisth Bhatt
Vashisth Bhatt
Python Web Development Techdegree Student 6,786 Points

Our game's player only has two attributes, x and y coordinates. Let's practice with a slightly different one, though. Th

Getting Bummer error

movement.py
# EXAMPLES:
# move((1, 1, 10), (-1, 0)) => (0, 1, 10)
# move((0, 1, 10), (-1, 0)) => (0, 1, 5)
# move((0, 9, 5), (0, 1)) => (0, 9, 0)

def move(player, direction):
    x, y, hp = player
    a,b = direction
    t = x+a
    w = y+b

    if t<0 or t>9 or w<0 or w>9:
        hp = hp-5
        t=x
        w=y

    return t, w, hp

1 Answer

Steven Parker
Steven Parker
171,136 Points

Your code looks good to me. :+1: So I tried pasting it directly into the challenge and it passed.

Try it again, perhaps after restarting your browser.