numpy - Python , check if a list follows a distribution -


i'm trying find short way check if list elements follow general distribution :

list = [1,3,5,7,9,11] 

the difference between list[i] , list[i+1] 2 , function want needs take in consideration list[i+1] - list[i] >= 2 .

one liners or lambdas welcome !

try this:

>>> l = [1,3,5,6,8,10] >>> all(y - x >= 2 x, y in zip(l, l[1:])) false  >>> l = [1,3,5,7,9,11] >>> all(y - x >= 2 x, y in zip(l, l[1:])) true 

as usual consider izip instead of zip if memory concern.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -