I'm currently making a Sudoku game because the logic behind the validation is very fun to code and there are plenty of ways to do it.
My question is very simple. Is there any function in python that checks if a value is present in a list more than once?
I made a little function that does this, and it works:
def IsRepeated(list):
overlap = False
for index, val in enumerate(list):
for step in range(index+1, len(list)):
if val == list[step]:
overlap = True
break
if overlap:
break
return overlap
The input is a list like a = [1,2,3,4,5,6]
This works perfectly, but I want to make sure there's no other better way to do this, as there typically is.