I get "IndexError: list index out of range" when I try to run this, even though the random choice made is within the list range. I want the computer to make a choice and perform a set of action that I have made. I can't seem to identify the issue in this code. I've inserted the code down below.(also I did import random)
def do_question():
questions = ["What is your favourite movie?", "What is your name?", "What are your hobbies?"]
q_choice = random.choice(questions)
if q_choice == questions[0]:
inter = input(f"{q_choice}")
questions.remove(q_choice)
print("Amazing! My favourite movie is Pirates Of The Caribbean: The Curse Of The Black Pearl")
if q_choice == questions[1]:
inter = input(f"{q_choice}")
questions.remove(q_choice)
print(f"Glad to talk to you, {inter}. I'm PYchatter.")
if q_choice == questions[2]:
inter = input(f"{q_choice}")
questions.remove(q_choice)
print("Wow! Those are nice hobbies you have. My hobby is talking to people like I am doing right now.")