-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchallenge_single.py
More file actions
52 lines (43 loc) · 967 Bytes
/
challenge_single.py
File metadata and controls
52 lines (43 loc) · 967 Bytes
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
"""
Reto:
Crear un array unidimensional.
Tranferir los datos a una linked structure sencilla
"""
from my_array import Array
from linked_list import SinglyLinkedList
# Creo mi Array
my_array = Array(10, 0)
# Imprimo mi array para verificar que esté creado.
# Al imprimir el objeto recurre a su metodo __str__
print(my_array)
print()
# Asigno valores random a mi array:
my_array.__randomitem__()
# Vuelvo a imprimir mi array con valores random
print(my_array)
print()
# Creo mi linked list:
my_linked = SinglyLinkedList()
# Cargo mi linked list con los valores del array:
for value in my_array.__iter__():
my_linked.append(value)
# Imprimo los valores de mi linked list ya cargada:
for value in my_linked.iter():
print(value)
print()
"""
23:36:12 👽 with 🤖 mgobea 🐶 in develop/python/data_structs_python …
➜ python3 challenge_single.py
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[6, 15, 10, 53, 50, 34, 90, 76, 32, 85]
6
15
10
53
50
34
90
76
32
85
"""