Using the Python code below, can you correctly take out the “while…
Question Answered step-by-step Using the Python code below, can you correctly take out the “while… Using the Python code below, can you correctly take out the “while true” and “sys. exit” out? My professor says never to use while true and that sys exit is unnecessary and I am not sure how to do that. Thank you.#Welcome to Dungeon Crawl: The Legacy!#By: Haley Poss#Version 1.0import sysdef start_game(): print(“Welcome to Dungeon Crawl!”)def load_game(): print(“Loading game…”)def quit_game(): print(“Quitting game…”) sys.exit()def enter_dungeon(): print(“Entering dungeon…”)def leave_dungeon(): print(“Leaving dungeon…”)def move_forward(): print(“Moving forward…”)def move_backward(): print(“Moving backward…”)def turn_left(): print(“Turning left…”)def turn_right(): print(“Turning right…”)def attack(): print(“Attacking…”)def pick_up_weapon(): print(“Picking up weapon…”)def use_key(): print(“Using key…”)def open_door(): print(“Opening door…”)def check_inventory(): print(“Checking inventory…”)def check_map(): print(“Checking map…”)def save_game(): print(“Saving game…”)def main_menu(): print(“Main menu…”)def help(): print(“Help…”)def credits(): print(“Credits…”)def quit_game(): print(“Quitting game…”) sys.exit()while True: print(“What would you like to do?”) print(“1. Start game”) print(“2. Load game”) print(“3. Quit game”) print(“4. Enter dungeon”) print(“5. Leave dungeon”) print(“6. Move forward”) print(“7. Move backward”) print(“8. Turn left”) print(“9. Turn right”) print(“10. Attack”) print(“11. Pick up weapon”) print(“12. Use key”) print(“13. Open door”) print(“14. Check inventory”) print(“15. Check map”) print(“16. Save game”) print(“17. Main menu”) print(“18. Help”) print(“19. Credits”) print(“20. Quit game”) choice = input(“Enter your choice: “) if choice == “1”: start_game() elif choice == “2”: load_game() elif choice == “3”: quit_game() elif choice == “4”: enter_dungeon() elif choice == “5”: leave_dungeon() elif choice == “6”: move_forward() elif choice == “7”: move_backward() elif choice == “8”: turn_left() elif choice == “9”: turn_right() elif choice == “10”: attack() elif choice == “11”: pick_up_weapon() elif choice == “12”: use_key() elif choice == “13”: open_door() elif choice == “14”: check_inventory() elif choice == “15”: check_map() elif choice == “16”: save_game() elif choice == “17”: main_menu() elif choice == “18”: help() elif choice == “19”: credits() elif choice == “20”: quit_game() else: print(“Invalid choice!”) sys.exit()print(“Game over!”)sys.exit() Computer Science Engineering & Technology Python Programming CIS 241 Share QuestionEmailCopy link Comments (0)


