python - How to use the count() method on a list excluding some items -


So, I want, in the list, there are any repeated numbers, but I want to exclude some of them I am How can I do this by using the counting method? What i

Example:

  list = [0,0,3,4] For the list in X: If the list.count (x) & gt; 1: Break the print ("repeated")  

Obviously it says repeat now, how can I avoid zero counting? I want to count the following numbers:

  only_ numbers_the_function_should_test = [1,2,3,4]  

I searched through the web and Nothing found Maybe it's impossible, can you give me a choice?

Note: I do not want to remove any list item. This is a Sudoku Solver I can not cut in such a number.

Paste in just one condition.

list for X: if x == 0: continue your code # rest

or if you want a specific category: < / P>

  If the X < = 0 or x & gt; 9: Continue  

Comments