Advertisement
Yegor2305

Untitled

Apr 4th, 2020
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. def any_duplicates(a):
  2.     for i in range(len(a)):
  3.         for j in range(len(a[i])):
  4.             if a[i][j] == a[i][j-1]  or a[i][j] == a[i][j-2]:
  5.                 return False
  6.             elif a[i][j] == 0:
  7.                 return False
  8.     return True
  9. print(any_duplicates([[1, 3, 2], [9, 7, 8], [4, 5, 6]]))
  10. print(any_duplicates([[8, 9, 2], [9, 6, 1], [3, 7, 4]]))
  11. print(any_duplicates([[1, 1, 3], [6, 5, 4], [8, 7, 9]]))
  12. print(any_duplicates([[0, 1, 2], [6, 4, 5], [9, 8, 7]]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement