What am I doing wrong? Python question

What am I doing wrong? Python question
0

Hi everyone,
I hope it’s ok if I ask this here.

I am brand new at computer programming, but I am taking an online class in python and need help with an assignment. I sent an email to my instructor but have not heard back and I would appreciate it if someone here could help.
I am building a 8 ball program that returns a random answer from one of 20 answers. It needs to say goodbye and end program if the user enters the words exit or bye.
I have it working fine except for one problem. If you type the word exit it says goodbye but doesn’t close.
I have tried everything I can think of. What am I doing wrong? Here is the code I wrote.

while input("What is your question? ") != 'exit':
	r = answers[random.randint(0, 19)]
	print(r)
else:
	print("Goodbye")
if input("What is your question? ") == 'bye':
	print("Goodbye")
else:
	print(r)

Thanks for any suggestions you can give me.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

I cannot really tell what your intended indentation is supposed to be, nor do I understand what you mean by “close”.
You do not have a program just with the code you have. Are you wanting the cmd to close or just the Python interpreter?