-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidation.py
More file actions
54 lines (49 loc) · 1.25 KB
/
validation.py
File metadata and controls
54 lines (49 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
def word_variations_count(total_words, selected_count):
return total_words ** selected_count
# Example usage:
total_words = 4
selected_count = 3
result = word_variations_count(total_words, selected_count)
print(result)
words_list = [
"word2",
"word4word2word3word1",
"word2word1word4word3",
"word3word4word1word2",
"word3word1word4word2",
"word1word2word4word3",
"word1_word2_word3_word4",
"word4word3word2word1",
"word4",
"word2word4word3word1",
"word3word1word2word4",
"word4word1word3word2",
"word1word3word4word2",
"word4word3word1word2",
"word1word4word2word3",
"word1word4word3word2",
"word2word4word1word3",
"word4word1word2word3",
"word3word4word2word1",
"word3",
"word3word2word4word1",
"word1word3word2word4",
"word2word3word1word4",
"word1word2word3word4",
"word2word1word3word4",
"word2word3word4word1",
"word3word2word1word4",
"word4word2word1word3",
"word1"
]
def has_duplicates(lst):
seen = set()
for word in lst:
if word in seen:
return True
seen.add(word)
return False
if has_duplicates(words_list):
print("Duplicates found in the list.")
else:
print("No duplicates found in the list.")