Skip to content

Commit 0fed939

Browse files
authored
Merge pull request mouredev#3081 from hozlucas28/Solution-17-Python
#17 - Python
2 parents 432d388 + 3e51ef8 commit 0fed939

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# pylint: disable=missing-function-docstring,pointless-string-statement,expression-not-assigned,unnecessary-lambda
2+
3+
"""
4+
Iterations...
5+
"""
6+
7+
from typing import Literal
8+
9+
10+
print("Iterations...")
11+
12+
START: Literal[1] = 1
13+
END: Literal[10] = 10
14+
15+
16+
def recursive_fn(*, end: int, start: int) -> None:
17+
print(start)
18+
if start < end:
19+
recursive_fn(
20+
end=end,
21+
start=start + 1,
22+
)
23+
24+
25+
print("\nFirst method...\n")
26+
recursive_fn(end=END, start=START)
27+
28+
print("\nSecond method...\n")
29+
for i in range(START, END + 1):
30+
print(i)
31+
32+
33+
print("\nThird method...\n")
34+
j = START
35+
while j <= END:
36+
print(j)
37+
j += 1
38+
39+
40+
print(
41+
"\n# ---------------------------------------------------------------------------------- #\n"
42+
)
43+
44+
"""
45+
Additional challenge...
46+
"""
47+
48+
print("Additional challenge...")
49+
50+
print("\nFirst method...\n")
51+
recursive_fn(end=END, start=START)
52+
53+
print("\nSecond method...\n")
54+
for i in range(START, END + 1):
55+
print(i)
56+
57+
58+
print("\nThird method...\n")
59+
j = START
60+
while j <= END:
61+
print(j)
62+
j += 1
63+
64+
print("\nFourth method...\n")
65+
[print(i) for i in range(START, END + 1)]
66+
67+
print("\nFifth method...\n")
68+
list(map(lambda i: print(i), range(START, END + 1)))

0 commit comments

Comments
 (0)