Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I want my if statement to evaluate True if answers[3] == 'Friday' and if answers[4] equals either of '13-15' or '15-17'
True
answers[3] == 'Friday'
answers[4]
'13-15'
'15-17'
Is below form correct?
if (answers[3] == 'Friday' and (answers[4] == '13-15' or answers[4] == '15-17')):
Yes it's correct, and you can use a set container in order to make the or statement more concise.
set
or
if answers[3] == 'Friday' and answers[4] in {'13-15', '15-17'}:
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.