<Python do not be afraid to copy and paste the code>
Tag: <None>
Python code do not be afraid to copy and paste code snippets
1 *. * [File] fib.py ~ 144B
# fib.py
def fib(n):
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
#:
print()
#:
fib(1000)
- [File] fib2.py ~ 160B
def end():
pass
def fib(n):
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
end
print()
end
fib(1000)
- [File] fib3.py ~ 150B
end = None
def fib(n):
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
end
print()
end
fib(1000)
- [File] fib3.py.txt ~ 712B
1 0 LOAD_CONST 0 (None)
3 STORE_NAME 0 (end)
3 6 LOAD_CONST 1 (<code object fib at 0x01D86480, file "fib3.py", line 3>)
9 LOAD_CONST 2 ('fib')
12 MAKE_FUNCTION 0
15 STORE_NAME 1 (fib)
10 18 LOAD_NAME 0 (end)
21 POP_TOP
11 22 LOAD_NAME 1 (fib)
25 LOAD_CONST 3 (1000)
28 CALL_FUNCTION 1 (1 positional, 0 keyword pair)
31 POP_TOP
32 LOAD_CONST 0 (None)
35 RETURN_VALUE
Recommended reading:
Basics zero Python's most detailed source of tutorials
2019 Python Reptile Learning Roadmap full version
Why Python can be firmly secured the first card AI Artificial Intelligence Language
Python rise, TIOBE list of programming languages a new high!