The Python Oracle

Combine multiple Booleans and Check if any are true in python

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Ocean Floor

--

Chapters
00:00 Combine Multiple Booleans And Check If Any Are True In Python
00:23 Accepted Answer Score 13
00:35 Answer 2 Score 0
00:47 Thank you

--

Full question
https://stackoverflow.com/questions/1879...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #boolean

#avk47



ACCEPTED ANSWER

Score 14


You can use any():

any([A, B, ...])



ANSWER 2

Score 0


If you want to check to see if ALL of the boolean variables are true, do the following:

 if all([length, zero_to_255, all_nums]) == True:
        print("Valid IP Address")