« first day (159 days earlier)      last day (4774 days later) » 

12:44 AM
h
 
 
5 hours later…
5:40 AM
0
Q: Python - How to group variables separated by or/and operators

TrufaI am trying to find a way to make the following (sample) code more elegant: if answer == "yes" or "Yes" or "Y" or "y" or "why not": print("yeah") In the same manner there in english you would not say: The possible answers are yes or Yes or Y or why not. and you would rather say: ...

 
 
9 hours later…
2:42 PM
@Trufa the way I would do it is just to so something like convert all input to string.lower() then check does input_string.startswith("y")
Or you can do it like this:
if ("YES".lower()).startswith("y") == True:

However its not super clean
 
 
1 hour later…
3:54 PM
@ril3y thank you
The thing is, this is actually just an example (yes and Yes and so...)
what I was looking for was exactly this:
 

« first day (159 days earlier)      last day (4774 days later) »