Now it’s time for you to begin coding your text-based adventure game! Starting at the top, convert each line of your pseudocode from your Coding Log into a line of Python code. Make sure to use the correct syntax and indentation. If you decide to challenge yourself and use functions, be sure to include the correct function calls. Your code should include at least two loops—one while loop and one for loop. Run and test your code in parts as you go. Follow the iterative process of coding and revising. It may be helpful to apply this process to each part of your game (Intro, Part 1, Part 2, and Part 3). Make the following improvements to your game: If the user types in a slightly different word than you expect, you don’t want your game to crash! Use lists to gain a better understanding of the input that users give. Refer back to Unit 1 for more information on lists. Here is an example: if choice in ["set a trap", "set trap", "trap", "make a trap", "make trap"] Your list won’t work if the user capitalizes any letter because the program won’t recognize a match between the same lowercase and uppercase letter. To convert the user input to all lowercase, use the lower function: if choice.lower() in ["set a trap", "set trap", "trap", "make a trap", "make trap"] Go through and make sure all of your inputs are converted to lowercase.

Here's an example of how the pseudocode can be converted into Python code while using lowercase conversions for user input:

```python
# Intro
print("Welcome to the Text Adventure Game!")
print("You find yourself in a mysterious room with three doors.")
print("Choose a door and see where it takes you.")

# Part 1
door_choice = input("Which door will you choose? (1, 2, or 3) ").lower()

while door_choice not in ["1", "2", "3"]:
print("Invalid choice. Please select a valid door.")
door_choice = input("Which door will you choose? (1, 2, or 3) ").lower()

if door_choice == "1":
print("You open the door and see a treasure chest!")

elif door_choice == "2":
print("You open the door and see a ferocious tiger!")

else:
print("You open the door and find yourself in a bottomless pit.")

# Part 2
print("You need to make a decision.")
decision = input("Will you fight or flee? ").lower()

while decision not in ["fight", "flee"]:
print("Invalid decision. Please enter 'fight' or 'flee'.")
decision = input("Will you fight or flee? ").lower()

if decision == "fight":
print("You attempt to fight the creature but you are no match for its strength.")

else:
print("You quickly turn and run away, narrowly escaping danger.")

# Part 3
print("With the creature behind you, you come across two paths.")
path_choice = input("Which path will you take? (left or right) ").lower()

while path_choice not in ["left", "right"]:
print("Invalid choice. Please select a valid path.")
path_choice = input("Which path will you take? (left or right) ").lower()

if path_choice == "left":
print("You follow the left path and discover a hidden treasure room.")

else:
print("You follow the right path and find yourself outside, free from danger.")

print("Congrats! You have successfully completed the adventure game.")
```

In this code snippet, the `lower()` function is used to convert the user input to lowercase for easier matching with the choices defined in the lists. This ensures that the game doesn't crash even if the user enters different capitalizations or slight variations of the expected choices.