import random #生成随机数
# from hanshu import f1 #引入模块的方法
# print(f1("hello,"))
import hanshu
print(hanshu.f1("你好,f1"))
a=random.random()
b=random.choice(["光子","张璐","王五","李柳","李莉","李老师"])
print(a)
print(b)
函数模块---hanshu:
def f1(a):
print(a,"方法被执行了!")
f1("666,") # 调用函数
def add(a,b,c,d):
e=a+b+c+d
print(e)
add(1,2,3,4)
def add(a,b,c,d):
e=a+b+c+d
return e
res=add(1,2,3,4)
print("本次相加的结果为:",res)
def zzj(f):
if f=="苹果" or f=="梨子" or f=="桃子":
print("正在榨汁!")
print("两分钟后...")
zhi="你要的一杯"+f+"汁好了,请慢用!"
return zhi