-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlimes.py
More file actions
36 lines (27 loc) · 660 Bytes
/
Copy pathlimes.py
File metadata and controls
36 lines (27 loc) · 660 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
def calculate(lime):
items = []
for i in range(lime):
position = len(items) - 1
if len(items) == 0:
items.insert(0, 1)
else:
flag = True
v = 1
while flag:
flag = iguales(items[position], v)
items.pop()
v += 1
position -= 1
if position <= 0:
flag = False
items[position] = v
print(items)
def iguales(ultimo, v):
if ultimo == v:
return True
else:
return False
def main():
print(calculate(5))
if __name__ == '__main__':
main()