Substract from list elements smaller then a number


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.