How to make specific list print after each input with while loop?
Hello, I am trying to make this while loop repeat after each user input until (4) Abort is triggered. In other words, I am trying to make the user able to input 1,2 and 3 one after the other, receive the print response without the program terminating. So far I have only managed to make it print infinitely, which is bad. I hope I made my question clear enough. Please support me with your suggestions and simplifications. Thank you! Code playground link: https://code.sololearn.com/csFfKd3fktQN Code below: print('''Welcome commander. Starship launch sequence initiated. For list of available commands, type \"list\" ''') list = ["(1) Start engines", "(2) Turn on autopilot", "(3) Launch", "(4) Abort"] input = input("Please input your command:").lower() while input != "4": print("List of available commands:", *list, sep='\n') if input == "1": print('Starting engines...') elif input == "2": print('Turning on autopilot...') elif input == "3": print('Launch sequence engaged...') elif input == "4": print('Aborting...') else: print('Input unrecognized. Try again.')