the following while loop keeps running continuously and I have no idea why
i=False
print(i)
while True:
if i==False:
i=True
print(i)
i was expecting one print of "False" and one print of "True" but it keeps looping continuously printing the True statement into infinity even though it should break the while condition once i updates its value.
Anyone know why?
while True:--Trueis alwaysTruei-- since that's what you're changing. Based on your code, you may wantwhile not i:.if i is Falserather than using==. Thoughif not iwould also be acceptable here.