Python Forum
define all function, interogate list, boolean - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: define all function, interogate list, boolean (/thread-1625.html)



define all function, interogate list, boolean - blacksaber - Jan-17-2017

Hi there. I have a problem to solve in python.
I need to define an all function to see if all the elements of a list meet a certain condition. For example: all (>5) [1,2,3] = true, all (>=2) [1,1,2,2,3,3] = false. I can't find a solution, since I don't have enough knowledge of programming. Can anyone help me please?


RE: define all function, interogate list, boolean - buran - Jan-17-2017

sounds like a homework to implement build-in function


RE: define all function, interogate list, boolean - blacksaber - Jan-17-2017

Do you know how to solve it?


RE: define all function, interogate list, boolean - buran - Jan-17-2017

Actually, the question is, do YOU know how to solve it?
Expect this thread to be moved to Homework section by mods and be prepared to show us your attempt to solve it (i.e. post your code and ask specific question). Most of the people here know how to solve it, but will not do your homework for you.