Extract values from a list based on a condition
I am trying to get a sample from a list based on a condition. It should be
easy to do but I am unable to do it as following:
a = [2,4,5,9,1,6,4]
b = 6
c = [x for x in a if a < b]
I basically need a new list which should contain values less than 6. Any
suggestions?
No comments:
Post a Comment