If you ask someone a yes/no question then the answer is one of these two options. In programming what if the response was "Y"
or "y"
or "yes"
or whatever?
I had to create a compound condition repeating my statement while its actually the same one. I'm not an expert but I can see that it can be improved.
def note_maker(note):
case_note = open("case_note.txt", "a+")
update = case_note.write("\n" + note)
multiple_inputs = input("Do you want to enter more details? Y/N")
while multiple_inputs == "yes" or multiple_inputs == "YES" or multiple_inputs == "Yes" or multiple_inputs == "Y" or multiple_inputs == "y":
update_again = case_note.write("\n" + input("Enter your additional information"))
multiple_inputs = input("Do you want to enter more details?")
case_note.close()
Is there a way to control the user input into what I expect?