Feb-02-2022, 10:24 PM
(This post was last modified: Feb-02-2022, 10:24 PM by BashBedlam.)
You just need to enter "exactly" what the if statement is expecting. In this case "Yes." That's capital "Y" and "period". You would do well to study ways to bullet proof your input. Anyway, here is working code.
print("Does she monitor it?") c2 = input() if c2 == "Yes.": print("So she must know about me.") elif c2 == "No.": print("Does she know about me?") c3 = input() if c3 == "Yes.": print("Of course. What does she think? About how you have a version of her in your computer?") if c3 == "No": print("Strange. How?")Also, try this out:
def check_user_answer (input_string: str) -> str : no = ['No', 'no', 'N', 'n'] yes = ['Yes', 'yes', 'Y', 'y'] if input_string in no : return 'no' if input_string in yes : return 'yes' return 'error' answer = 'error' while answer == 'error' : test_answer = input ('Does she monitor it? ') answer = check_user_answer (test_answer) if answer == 'yes' : print("So she must know about me.") if answer == 'no' : answer = 'error' while answer == 'error' : test_answer = input ("Does she know about me?") answer = check_user_answer (test_answer) if answer == 'yes' : print('Of course. What does she think? About how', end = '') print (' you have a version of her in your computer?') if answer == 'no' : print ('Strange. How?')
Output:Does she monitor it? n
Does she know about me?y
Of course. What does she think? About how you have a version of her in your computer?