I have a for loop. Each time it iterates, prints a list. But, some of the printed lists are the same. How can I understand how many different lists I have and what are the different lists? In other words, I just want to see the distinct lists and the number of them.

Thank you

  • $\begingroup$ Without your code, it will be difficult to help you. Likely, you want to use a Table instead of a For loop, and then use something like DeleteDuplicates. $\endgroup$ – march Sep 28 '17 at 17:23
  • $\begingroup$ Beware of using Print[ ] for anything other than printing messages. You can prepare a list in a For[ ] loop, but it is much better to use Table[ ] or Map[ ] $\endgroup$ – Gustavo Delfino Sep 28 '17 at 17:37

DeleteDuplicates[ ]


Length[DeleteDuplicates[ ]]

| improve this answer | |
  • $\begingroup$ Thanks all. The commands work! $\endgroup$ – A. Mpi Sep 28 '17 at 18:22
  • $\begingroup$ @A. Mpi: So perhaps an accept or at least up-vote perhaps? $\endgroup$ – David G. Stork Sep 28 '17 at 18:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.