Reputation: 5
Ok so I'm creating a loop:
def equ(par1,par2):
con1=4/par1
ready=False
add=False
if ready==True:
if add==True:
par2+=con1
add=False
print("true")
elif add==False:
par2-=con1
add=True
print("False")
elif ready==False:
par2=con1
ready=True
input()
return par2
Every time I run the program it doesn't do what it's supposed to. I notice that it will NOT change ready to true. Could any one give me some help? THANKS! :)
Upvotes: 0
Views: 2840
Reputation: 106518
First, you have no looping construct. You only have a linear flow of logic.
Second, ready==True
will never be true, since it is explicitly set to False
before that code block is ever hit.
If you're intending to reuse the boolean value ready
, then you'd either want to preserve its state somewhere outside of the scope of the method - once you leave the method, it goes right back through and sets it to False
again.
Upvotes: 1