[Solved] while loop input Yes/No (Python 3)


//This code is for explanation 

quiz = str(input("would you like to answer some questions \n choose y/n"))

quiz = quiz.lower()

while quiz != 'y' and quiz != 'n': //here you are using != that will result false this logic works fine with !

//while quiz == 'y' or quiz == 'n': //will work for or

print("please choose 'y' or 'n'")

input("y/n?")

//this code will work 

quiz = str(input("would you like to answer some questions \n choose y/n"))

quiz = quiz.lower()

while quiz != 'y' and quiz != 'n':

   print("please choose 'y' or 'n'")

   input("y/n?")

I hope this helps.

You may be interested in flow charts or Algorithms please follow this link: https://www.edrawsoft.com/explain-algorithm-flowchart.php

You may also be interested to learn about python more please follow this link: https://www.python.org/about/gettingstarted/

Thank you.

2

solved while loop input Yes/No (Python 3)