-1
$\begingroup$

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

$\endgroup$

closed as off-topic by Yves Klett, MikeLimaOscar, LCarvalho, MarcoB, LLlAMnYP Sep 29 '17 at 11:30

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – MikeLimaOscar, MarcoB, LLlAMnYP
  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Yves Klett, LCarvalho
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\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
2
$\begingroup$

DeleteDuplicates[ ]

and

Length[DeleteDuplicates[ ]]

$\endgroup$
  • $\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.