Posted By

silviud on 05/11/11


Tagged


Versions (?)

Substract from list elements smaller then a number


 / Published in: Python
 

  1. >>> n
  2. [1, 2, 5, 10, 3, 100, 9, 24]
  3. >>> n1 = []
  4. >>> for i in n:
  5. ... if i < 5: continue
  6. ... n1.append(i)
  7. ...
  8. >>> n1
  9. [5, 10, 100, 9, 24]
  10. >>> n = n1

Report this snippet  

You need to login to post a comment.