forked from mouredev/roadmap-retos-programacion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mouredev.py
56 lines (39 loc) · 754 Bytes
/
mouredev.py
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
55
56
"""
Ejercicio
"""
# For
for i in range(1, 11):
print(i)
# While
i = 1
while i <= 10:
print(i)
i += 1
# Recursividad
def count_ten(i=1):
if i <= 10:
print(i)
count_ten(i + 1)
count_ten()
"""
Extra
"""
for e in [1, 2, 3, 4]:
print(e)
for e in {1, 2, 3, 4}:
print(e)
for e in (1, 2, 3, 4):
print(e)
for e in {1: "a", 2: "b", 3: "c", 4: "d"}:
print(e)
for e in {1: "a", 2: "b", 3: "c", 4: "d"}.values():
print(e)
print(*[i for i in range(1, 11)], sep="\n")
for c in "Python":
print(c)
for e in reversed([1, 2, 3, 4]):
print(e)
for e in sorted(["m", "o", "u", "r", "e"]):
print(e)
for i, e in enumerate(sorted(["m", "o", "u", "r", "e"])):
print(f"Índice: {i}, valor: {e}")