1

I'm constructing an interactive timetable for terminal with Python, but at the end of my code where i have if, elif and else statements no matter what user input i give it keeps passing the if statement. Any Solutions would be greatly appreciated and Thank You for your time :)

while True:
    TimeTable()
    print "\nDo you wish to go again? "
    answer = raw_input()
    if answer == "Yes" or "yes":
        print " "
        continue
    elif answer == "No" or "no":
        print "Ok then"
        break
    else:
        print "Ok then"
        break

1 Answers1

2
answer == "Yes" or "yes"

# is the same as
(answer == "Yes") or "yes"

and is always True. You can solve your problem this way:

answer in ["Yes", "yes"]
honza_p
  • 2,073
  • 1
  • 23
  • 37