python - Counter through embedded if statements inside for loop -
so, have script in python (2.7) makes list of 1000000 numbers between 1 , 5000 , runs loop on entire list checking each element against multiple embedded if statments.
ex:
i = 0 number in random_list: += 1 if random_list[number] <= 3000: += 1 if random_list[number] <= 300: += 1 if random_list[number] <= 30: += 1 if random_list [number] <= 3: += 1 break print
the whole point being want see how many "checks" occur on entire list.
unfortunately value less total number of elements in list should not case since each element should checked @ least once. i'm getting in range of 1000's 10000's.
i'm sure there's more pythonic way of doing this, advice on how achieve i'm trying appreciated.
extra = 0 values = (random_list[number] i,number in enumerate(my_numbers)) v in values: += sum(v < x x in [3000,300,30,3]) if v < 3:break; print i+extra
maybe ...
Comments
Post a Comment