Unable to code while loops?

I hope this is where I ask questions about things I should probably already know…
I’m trying to code a while loop in a jupyter notebook (python3) in the following way:

run = True
while run:
some stuff

Jupyter keeps throwing a syntax error at the line ‘run = True’
I assume there is actually a way to assign a variable a boolean value in jupyter?..

Ah, shit… I don’t think I can delete this post now… Couldn’t figure out how. I tried the same syntax in a smaller shell, and it worked… So somehow my other code prevents the proper interpretation of the variable assignment… So I guess I’m just stupid. Sorry all for wasting your time