User-Driven Question Selection

  • Share this:

Code introduction


This function allows the user to select a question from a predefined list. The user is prompted to make a selection, and the function returns the selected question.


Technology Stack : PyInquirer

Code Type : Interactive list selection

Code Difficulty : Intermediate


                
                    
def list_questions(questions):
    from pyinquirer import List

    question = List(
        prompt="Please choose a question to ask:",
        choices=questions
    )
    return question.prompt()                
              
Tags: