Skip to content

Commit 7b5c6dc

Browse files
committed
Ejercicio duplicados en Python.
1 parent 6c4d955 commit 7b5c6dc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

gerardo_martinez_romero.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
def firs_duplicate(numbers):
2+
dict = {}
3+
result = -1
4+
5+
for index in range(0, len(numbers)):
6+
element = numbers[index]
7+
if element not in dict.keys():
8+
dict[element] = True
9+
else:
10+
result = element
11+
break
12+
13+
return result
14+
15+
lista_valores = [2, 3356, 52, 32, 65, 9, 2, 3356]
16+
print(firs_duplicate(lista_valores))
17+
18+
lista_valores = [3356, 52, 32, 65, 9, 2, 3356]
19+
print(firs_duplicate(lista_valores))
20+
21+
lista_valores = [ 52, 32, 65, 9, 2, 3356]
22+
print(firs_duplicate(lista_valores))

0 commit comments

Comments
 (0)