First thing that comes to mind is doing it with a for loop.
But a nice thing to try would be putting all elements you want to check in a set and then checking its length, since there will be no duplicate items.
Doing it that way is also practical, because you can keep using/modifying the same set throughout the program, if it is a long running/repetitive task.
But a nice thing to try would be putting all elements you want to check in a set and then checking its length, since there will be no duplicate items.
Doing it that way is also practical, because you can keep using/modifying the same set throughout the program, if it is a long running/repetitive task.