How to use or function in a while loop python? -
some of code...
reenter = "t" while reenter != "f" , reenter != "f": n1 = int(input("please enter first number in equation : ")) o = str(input("please enter operation (/,*,-,+) : ")) n2 = int(input("please enter second number in equation: ")) reenter = input(n1 + o + n2 formula correct? t/f?")
i need cater both capitalised , uncapitalised f. ths issue won't exit loop, help??
thank in advance - zyrn
don't use input()
user input, rather raw_input()
. difference input()
tries evaluate user input, not want. other issues string formatting, etc., check below.
reenter = "t" while reenter != "f" , reenter != "f": n1 = int(raw_input("please enter first number in equation : ")) o = raw_input("please enter operation (/,*,-,+) : ") n2 = int(input("please enter second number in equation: ")) reenter = raw_input("{}{}{} formula correct? t/f?".format(n1, o, n2))
p.s. not sure trying do, seems may want invert "t"/"f" logic there? :)
Comments
Post a Comment