-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapplication.py
More file actions
66 lines (50 loc) · 1.36 KB
/
application.py
File metadata and controls
66 lines (50 loc) · 1.36 KB
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
57
58
59
60
61
62
63
64
65
66
import math
from funciones_1 import f
from Utils.contador_de_llamadas_definition import contador_de_llamadas
# import Utils.contador_de_llamadas_definition
from clase_objetos_1 import Persona
from factorial_decorator import factorial
from Utils.memoize import Memoize
from Utils.clock import clock
@contador_de_llamadas
def factorial_2(x):
def factorial_interior(x):
if x == 0:
return 1
else:
return x * factorial_interior(x - 1)
if type(x) == int and x >= 0:
return factorial_interior(x)
else:
raise TypeError("Error, no se puede realizar operacion")
@Memoize
def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fibonacci(n-1) + fibonacci(n-2)
def main():
print("Este el entry point de mi programa")
funcion_1 = clock(f(1))
funcion_2 = f(2)
print(funcion_1(1))
print(funcion_2(1))
print(factorial_2.calls)
for n in range(1, 10):
print(n)
print(factorial_2(n))
print(factorial_2.calls)
una_persona = Persona('ale')
otra_persona = Persona('Francisco')
print(una_persona)
print(otra_persona)
print(Persona.funcname)
for n in range(1, 10):
print(n)
print(factorial(n))
# Executed twice, please check the debug
print(fibonacci(40))
print(fibonacci(40))
main()