Let py know that (input1) == (input2)
I want to let my script stop, first I ask when I want to stop it:
length = input("how many times " + str(num1) + str(" do you want to see?"))
(E.G. I say ‘3’ the length should be 3)
Then I want to ‘ask’ if length is the same as where it must be when it should finish:
if length == times
(times is where my script is ATM)
This doesn’t work, but if I set times to a number it does work…
Even when I print both of them (print (times, length)
) it shows the same (3, 3) in my console, but it doesn’t do something… this is my script:
length = input("how many times " + str(num1) + str(" do you want to see?"))
print("starting!")
time.sleep(2)
ORnum1 = num1
times = 1
while CalcMeth == "repeat":
if C == "Yes":
print(times, "times", ORnum1, "=", num1)
num1 = num1 + ORnum1
if length == times:
C = "no"
print("Reached End, stopping.")
else:
time.sleep(num2)
times = times + 1
elif C == "no":
time.sleep(2)
print ("stopped!")
sys.exit()
if length == times:
here in your code length is in str and times is in integer.
length = int(input("how many times " + str(num1) +" do you want to see?))