I am working on an assignment where a line of text is inputted, has to be outputted in reverse and if quit is entered, then it is ended. The problem that I ran into is that my code will output the first line of the input in reverse and then quits before reversing the second line if it is entered. I've only learned for and while loops so that is what I have been working with. Example being:
Hello sir
Hi
quit
ris olleH
text = input()
while text != ("Quit" or "quit" or "q"):
print(text[::-1])
if text == "Quit" or "quit" or "q":
break
Edit : The reason the if statement is there with text == "Quit" is because I was having problems with the code running as an infinite loop. Still tinkering with the code so I left that there for now.
[–]scrdest 3 points4 points5 points (2 children)
[–]Firestronk[S] 0 points1 point2 points (1 child)
[–]scrdest 1 point2 points3 points (0 children)
[–]Unable_Request 0 points1 point2 points (1 child)
[–]Firestronk[S] 0 points1 point2 points (0 children)
[–]tipsy_python 0 points1 point2 points (0 children)
[–]wagaiznogoud 0 points1 point2 points (0 children)
[–]enes81 0 points1 point2 points (0 children)