Created
July 15, 2017 12:14
-
-
Save ivlevdenis/c7865ed50291490c507fe2a6d3963b83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lib import fib | |
print(fib(1000)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lib import * | |
print(fib(1000)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fibonacci numbers module | |
def fib(n): # write Fibonacci series up to n | |
a, b = 0, 1 | |
while b < n: | |
print(b, end=' ') | |
a, b = b, a+b | |
print() | |
def fib2(n): # return Fibonacci series up to n | |
result = [] | |
a, b = 0, 1 | |
while b < n: | |
result.append(b) | |
a, b = b, a+b | |
return result | |
def fib3(n): # return Fibonacci series up to n | |
result = [] | |
a, b = 0, 1 | |
while b < n: | |
result.append(b) | |
a, b = b, a+b | |
return result | |
def fib4(n): # return Fibonacci series up to n | |
result = [] | |
a, b = 0, 1 | |
while b < n: | |
result.append(b) | |
a, b = b, a+b | |
return result | |
def fib5(n): # return Fibonacci series up to n | |
result = [] | |
a, b = 0, 1 | |
while b < n: | |
result.append(b) | |
a, b = b, a+b | |
return result | |
def fib6(n): # return Fibonacci series up to n | |
result = [] | |
a, b = 0, 1 | |
while b < n: | |
result.append(b) | |
a, b = b, a+b | |
return result | |
def fib7(n): # return Fibonacci series up to n | |
result = [] | |
a, b = 0, 1 | |
while b < n: | |
result.append(b) | |
a, b = b, a+b | |
return result | |
def fib8(n): # return Fibonacci series up to n | |
result = [] | |
a, b = 0, 1 | |
while b < n: | |
result.append(b) | |
a, b = b, a+b | |
return result | |
def fib9(n): # return Fibonacci series up to n | |
result = [] | |
a, b = 0, 1 | |
while b < n: | |
result.append(b) | |
a, b = b, a+b | |
return result | |
def fib10(n): # return Fibonacci series up to n | |
result = [] | |
a, b = 0, 1 | |
while b < n: | |
result.append(b) | |
a, b = b, a+b | |
return result | |
def fib11(n): # return Fibonacci series up to n | |
result = [] | |
a, b = 0, 1 | |
while b < n: | |
result.append(b) | |
a, b = b, a+b | |
return result | |
def fib12(n): # return Fibonacci series up to n | |
result = [] | |
a, b = 0, 1 | |
while b < n: | |
result.append(b) | |
a, b = b, a+b | |
return result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(venv) di-erz@worklap:~/projects/test_import$ \time -v python3.6 app1.py | |
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 | |
None | |
Command being timed: "python3.6 app1.py" | |
User time (seconds): 0.06 | |
System time (seconds): 0.00 | |
Percent of CPU this job got: 96% | |
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.06 | |
Average shared text size (kbytes): 0 | |
Average unshared data size (kbytes): 0 | |
Average stack size (kbytes): 0 | |
Average total size (kbytes): 0 | |
Maximum resident set size (kbytes): 9100 | |
Average resident set size (kbytes): 0 | |
Major (requiring I/O) page faults: 0 | |
Minor (reclaiming a frame) page faults: 1114 | |
Voluntary context switches: 1 | |
Involuntary context switches: 9 | |
Swaps: 0 | |
File system inputs: 0 | |
File system outputs: 0 | |
Socket messages sent: 0 | |
Socket messages received: 0 | |
Signals delivered: 0 | |
Page size (bytes): 4096 | |
Exit status: 0 | |
(venv) di-erz@worklap:~/projects/test_import$ \time -v python3.6 app2.py | |
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 | |
None | |
Command being timed: "python3.6 app2.py" | |
User time (seconds): 0.06 | |
System time (seconds): 0.00 | |
Percent of CPU this job got: 98% | |
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.06 | |
Average shared text size (kbytes): 0 | |
Average unshared data size (kbytes): 0 | |
Average stack size (kbytes): 0 | |
Average total size (kbytes): 0 | |
Maximum resident set size (kbytes): 9084 | |
Average resident set size (kbytes): 0 | |
Major (requiring I/O) page faults: 0 | |
Minor (reclaiming a frame) page faults: 1117 | |
Voluntary context switches: 0 | |
Involuntary context switches: 8 | |
Swaps: 0 | |
File system inputs: 0 | |
File system outputs: 0 | |
Socket messages sent: 0 | |
Socket messages received: 0 | |
Signals delivered: 0 | |
Page size (bytes): 4096 | |
Exit status: 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment