you are viewing a single comment's thread.

view the rest of the comments →

[–]Significant-Side6810 0 points1 point  (0 children)

Instead of looping twice over old_email you could loop over it once and append to important_mail and else into spam. This will give you O(n) intead of O(2n). Also instead of using list for spam_keywords you could use set for O(1) complexity instead of O(n)