I am trying to ask the user whether they want to see a book, and then asking if they know the story. I the want to then tell the user how many stories they know out of how many attempts. Unfortunately the program won't quit at the correct time.
# Set count list to zero
count_y = 0
count_all = 0
# Asking the user whether they want to see a book
exit = False
while not exit:
user_input = input('Enter s to see a book and q to quit: ')
if user_input == 'q':
exit = True
elif user_input == 's':
show_book()
# I am trying to tell the user how many stories they knew out of their total attempts.
user_answer = input('Did you know the stories? Press Y or N: ')
if user_answer == 'y':
count_y = count_y + 1
elif user_answer == 'y' or 'n':
count_all = count_all + 1
# print the result to the user.
print('You knew',(count_y), 'out of', (count_all), 'stories .')