GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — modify the code of chapter03 · morristech/StarterLearningPython@e03ccaa

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • python3code/chapter03
    • decorate.py
    • fibsbetter.py
    • foo1.py
    • foo2.py
    • weight.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎python3code/chapter03/decorate.py‎

Copy file name to clipboardExpand all lines: python3code/chapter03/decorate.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# coding:utf-8
2+
'''
3+
filename: decorate.py
4+
'''
25

36
def p_decorate(func):
47
def wrapper(name):
Collapse file

‎python3code/chapter03/fibsbetter.py‎

Copy file name to clipboard
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# coding:utf-8
2+
"""
3+
the better Fibonacci
4+
filename: fibsbetter.py
5+
"""
6+
7+
m = {0:0, 1:1}
8+
9+
def fib(n):
10+
if not n in m:
11+
m [n] = fib(n-1) + fib(n-2)
12+
return m[n]
13+
14+
f = fib(10)
15+
print(f)
Collapse file

‎python3code/chapter03/foo1.py‎

Copy file name to clipboard
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#coding:utf-8
2+
'''
3+
filename: foo1.py
4+
'''
5+
def foo():
6+
def bar():
7+
print("bar() is running")
8+
print("foo() is running")
9+
10+
foo() #调用函数
Collapse file

‎python3code/chapter03/foo2.py‎

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#coding:utf-8
2+
'''
3+
filename: foo2.py
4+
'''
5+
def foo():
6+
def bar():
7+
print("bar() is running")
8+
bar() #显示调用内嵌函数
9+
print("foo() is running")
10+
11+
foo()
Collapse file

‎python3code/chapter03/weight.py‎

Copy file name to clipboardExpand all lines: python3code/chapter03/weight.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# coding:utf-8
2-
2+
'''
3+
filename: weight.py
4+
'''
35
def weight(g):
46
def cal_mg(m):
57
return m * g

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.