# 形参和实参的案例# 参数person只是一个符号# 调用的时候用另一个defhello(person):print("{0},你好吗?".format(person))print("{},你看见我的小猫了么?".format(person))returnNone
p ="小明"# 调用函数,需要把p作为实参传入
hello(p)
小明,你好吗?
小明,你看见我的小猫了么?
aa = hello("小刘")print(aa)
小刘,你好吗?
小刘,你看见我的小猫了么?
None
# help负责随时为你提供帮助help(print)
Help on built-in function printin module builtins:print(...)print(value,..., sep=' ', end='\n',file=sys.stdout, flush=False)
Prints the values to a stream,or to sys.stdout by default.
Optional keyword arguments:file: a file-like object(stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.
# 九九乘法表for i inrange(1,10):for j inrange(1,i+1):if j == i:print(i*j)else:print(i*j,end="\t")print()for i inrange(1,10):for j inrange(1,i+1):print(i*j,end=" ")print()1243694812165101520256121824303671421283542498162432404856649182736455463728112436948121651015202561218243036714212835424981624324048566491827364554637281
# 尝试使用函数来写乘法表defjiujiu():for i inrange(1,10):for j inrange(1,i+1):print(i*j,end=" ")print()returnNone
jiujiu()
jiujiu()1243694812165101520256121824303671421283542498162432404856649182736455463728112436948121651015202561218243036714212835424981624324048566491827364554637281
defprintLine(line_number):for i inrange(1, line_number +1):print(i * line_number, end=" ")print()defxinjiujiu():for i inrange(1,10):
printLine(i)
xinjiujiu()12436948121651015202561218243036714212835424981624324048566491827364554637281