I want the user to type "right" or "left" and according to the input, some action will take place.
If the user types "right" the first two times, the smiley becomes sad and can't get out of the forest. If the user types "right" anymore number of times, the smiley always becomes frustrated, chops some trees, makes a table and flips it out as it can't get out of the forest.
As soon as the user types "left", the smiley gets out of the forest.
Here is my Python code:
n = input("You are in the Lost Forest\n****************\n****************\n :)\n****************\n****************\nGo left or right? ")
i = 1
while n == "right" or n == "Right" and i < 3:
n = input("You are in the Lost Forest\n****************\n****************\n :(\n****************\n****************\nGo left or right? ")
i = i + 1
while n == "right" or n == "Right" and i >= 3:
n = input("You are in the Lost Forest\n****************\n****** ***\n (╯°□°)╯︵ ┻━┻\n****************\n****************\nGo left or right? ")
print("\nYou got out of the Lost Forest!\n\o/")
The problem is that even if the user types "right" third, fourth or fifth time and so on, the "flipping out" action doesn't take place. The smiley only becomes sad, it doesn't come out of the first loop.
What am I doing wrong here?
A or B and C, does this mean(A or B) and CorA or (B and C)?