It works if you put all this in a function:
def test(): while True: a=5 if a<6: break print("hello")
If you try to do this outside the function (only in the interpreter), she does not know how to redeem it all, since she can only process one statement at a time in the interpreter. Your while is such a statement, and your print material is such a statement, so you have two statements, but the interpreter only accepts one.
source share