MCPcopy Create free account
hub / github.com/geekcomputers/Python / compareFibonacciCalculators

Function compareFibonacciCalculators

fibonacci.py:58–73  ·  view source on GitHub ↗

Interactively compare both fibonacci generators

(n: int)

Source from the content-addressed store, hash-verified

56
57
58def compareFibonacciCalculators(n: int) -> None:
59 """
60 Interactively compare both fibonacci generators
61 """
62
63 startI = time.clock()
64 resultI = getFibonacciIterative(n)
65 endI = time.clock()
66
67 startR = time.clock()
68 resultR = getFibonacciRecursive(n)
69 endR = time.clock()
70
71 s = "{} calculting {} => {} in {} seconds"
72 print(s.format("Iteratively", n, resultI, endI - startI))
73 print(s.format("Recursively", n, resultR, endR - startR))

Callers

nothing calls this directly

Calls 2

getFibonacciIterativeFunction · 0.85
getFibonacciRecursiveFunction · 0.85

Tested by

no test coverage detected