mercredi 1 novembre 2017

what is wrong in these if and else statements in python? [duplicate]

This question already has an answer here:

i am new with python and i am trying to make a survey but when i write this code things don't go well this is the first part of my very long survey:

#a program to test your adhd
yes=1
YES=1
Yes=1
no=0
NO=0
No=0
print("please honestly answer the following questions","\n"
"with \"yes\" or \"no\" ")
a=input("1. do you have difficulty getting organized ?")#q1
if a==yes or YES or Yes or no or NO or No:
b=input("2. When given a task, you usually procrastinate rather than doing it right away")#q2    
else:
print("wrong answer")
a=input("1. do you have difficulty getting organized ?")#q1

the idea of this is when the user write one of the true answers the program move to the next question. and if he wrote other things the program print wrong answer and repeat the question. but when tested with python shell and c.m.d it never consider the (else statement)

note that: i don't know many things in python (besides if and else statements) yet as i am at the very beginning on learning steps.

Aucun commentaire:

Enregistrer un commentaire