For eg if I have
old_list = [1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 9]
and I want to remove elements with more than (x = 2) 2 instances and make it look like this
new_list = [1, 3, 4, 5, 7, 8]
For eg if I have
old_list = [1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 9]
and I want to remove elements with more than (x = 2) 2 instances and make it look like this
new_list = [1, 3, 4, 5, 7, 8]
برچسب:
نویسنده: استخدام کار