Reputation: 13
I want my if statement to evaluate True
if answers[3] == 'Friday'
and if answers[4]
equals either of '13-15'
or '15-17'
Is below form correct?
if (answers[3] == 'Friday' and (answers[4] == '13-15' or answers[4] == '15-17')):
Upvotes: 0
Views: 95
Reputation: 107297
Yes it's correct, and you can use a set
container in order to make the or
statement more concise.
if answers[3] == 'Friday' and answers[4] in {'13-15', '15-17'}:
Upvotes: 1