I am a very new beginner in python programming so I hope my question makes sense.
I want to make a program of a medical interview with guided questions depending on the user answers to previous questions.
I started with basic if/else structure but I am blocked because I don't know how to ask something in an if/else structure. For example :
A = input("Question 1 ? ")
if A == "yes":
print("Consequence of yes to question 1")
else:
A == "no"
print("Consequence of no to question 1")
if A == "no":
B = input("Question 2 ?")
It seems I can't put input
statement in an if
statement because when I run, it does not take the B = input("Question 2 ?")
into account. But I need to assign a yes/no answer to Question 2 so I can pursue the interview. All I saw on the internet is print
statements in if/else structure. I also tried to do nested if
statements but it doesn't work.
Could someone help me please ? Thanks a lot
Aucun commentaire:
Enregistrer un commentaire