Loops Condition - 2 . Why can't I put this


Hi, The code in the instructions is:

loop_condition = True

while loop_condition:
print "I am a loop"
loop_condition = False

I was wondering if there is any reason why you could not just delete the first line and modify the next line to:
while loop_condition = True:

Does any one know if this is allowed? If not, why not?


the = operator is used for assignment operation(i.e. you want to assign some value to a variable) but the while construct requires a Boolean(true or false statement for condition) so when you write

loop_condition = True

before using it in the wile loop it will evaluate to true.
but when you try to assign it while using it in the while loop like this

while loop_condition = True:

it will not work because that is not a statement that will evaluate to true or false
you can rather do this

while loop_condition == True