Repository navigation
Expand file tree
/
Copy path14.py
More file actions
197 lines (124 loc) · 2.33 KB
/
Copy path14.py
File metadata and controls
197 lines (124 loc) · 2.33 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#-------------------------- 函数--------——————————————————-------
#
#
#函数的作用: 封装代码, 高效的代码重用
#
#
#
#
# def 函数名(参数):
# 代码1
# 代码2
# 。。。
# def A():
# print("显示余额")
# print("存款")
# print("取款")
#
#
# print("恭喜您登入成功")
# A()
# print("你的余额是1000000000000000000000000000")
# A()
# print("去了300元")
# A()
#
#
#
# def B():
# print("Hello World")
#
# B()
#
#
# def add_num(A, B):
# result=A+B
# print(result)
# add_num(1, 3)
# add_num(100, 200)
#
#
#
# def c():
# return "酒"#return 下方的代码 不执行
#
#
# good=c()
# print(good)
#
#
#
# def d(a, b):
# return a+b
# bd=d(3, 5)
# print(bd)
#------------函数说明文档-----------
#---------help(len())
# help函数作用: 查看函数的说明文档(函数的解释说明的信息)
#
# def xxx(a, b):
# """求和函数"""
# return a + b
#
# help(xxx)
#
#
#
# def xxx1(a, b):
# """
# 求和函数
# :param a:参数一
# :param b: 参数二
# :return: 返回值
# """
# return a + b
#
# help(xxx1)
#-----------两个函数 testA 和 testB -- 在A里面嵌套调用B
# # B函数
# def testB():
# print("从B函数开始------")
# print("这是B函数")
# print("从B函数结束------")
#
#
#
# # A函数
# def testA ():
# print("从A函数开始-----")
# testB()
# print("从A函数结束-----")
#
#
#
# testA()
#
#------------打印图形--------------
def print_line():
print("-"*20)
#--------------------------------------------
#--------------函数嵌套-----------------
# def print_line():
# print("-"*20)
#
#
# def type_line(num):
# i=0
# while i < num:
# print_line()
# i += 1
#
# type_line(5)
#---------------求三个数平均值-----------
#--求和
def three_sum(a, b, c):
return a+b+c
# H=three_sum(1, 2, 2)
#
# print(H)
#--平均值
def three_average(a, b, c):
result=three_sum(a, b, c)/3
return result
jjj=three_average(2, 3, 4)
print(jjj)