how do I break while loop by raw_input()? python 3

Viewed 1899

I need some help understanding the differences between the following. In the first example, I want the loop to break when the user inputs False:

true = True

while true:
    print("Not broken")
    true = input("to break loop enter 'False' ")

There was a question asked at: how do I break infinite while loop with user input

Which gives this solution:

true= True

while true:
    print("Not broken")
    true = input("to break loop enter 'n' ")
    if true == "n":
        break
    else:
        continue

And I don't understand why the first method doesn't work and the second does??? Why doesn't python take the input as if someone was changing the script and change the variable "true"? Whats going on behind the scenes?

Any help would be appreciated. Thanks in advance :)

1 Answers
Related