Issue getting loop/break to work in thonny

Hi all,

Im new to coding and just learning to use python, currently using thonny.

Im following a pi manual, instructing me to write a text-based game, most of the code was provided by rasp pi, only what ive included is my own.

There is an issue when I attempt to create a loop, which prompts the user with text, followed by a break.

When this loop should activate it does not - game carries on when it shouldn’t, text does not appear, and when break is indented within loop it creates a syntax error.

Picture attached below, can provide more images (new users limited to amount they can attach)

Also,

At this point text indicating “GAME OVER” Should appear but it does not, instead it treats ‘monster’ like any other object

For the first screenshot, is the if statement inside a loop? You can only break out of loops (for/while). You can’t break out of an if statement which isn’t inside a loop.

// This WORKS
i = 4
for j in range(20):
    if j == i:
        break
    print(j)
// Output: 0 1 2 3 (printed on separate lines)

// This DOES NOT WORK
i = 4
if i == 4:
    print(i)
    break
// SyntaxError: 'break' outside loop
// Since the if statement isn't nested in a loop, so break isn't applicable.