函数
# 函数:就是工具
# 1、内置函数print
# 2、自定义函数
'''
##################
alex sb sb
##################
'''
# def print_line():
# print('#'*9)
#
# def print_msg():
# print('alxe db')
#
# print_line()
# print_msg()
# print_line()
#
# 函数只会执行第一个return
# '''
# def 函数名(arg1,arg2,arg3):
# "描述信息"
# 函数体
# return 1
# '''
# # 定义无参函数:函数的执行就是普通的语句,不用外界传来的值
# def foo():
# "foo function"
# print("from haha")
# print(foo.__doc__)
#
# # 定义有参函数
# def bar(x,y):
# print(x)
# print(y)
#
# # 定义空函数:什么都不做
# def auth():
# pass
#
# # 把产品列出来
# def list_good():
# "商品列表"
# pass
# # 购买
# def buy():
# "购买"
# pass
#
# # 认证
# def interactive():
# "用户交互"
# list_good()
# money=input(">>:")
# goods=input(">>:")
# buy(money,goods)
#
# return的作用:
# def bar(x,y):
# print("from")
# res=x+y
# return res
#
# z=bar(1,2)
# print(z)
#
# rest=bar(1,2)+3
# reat1=bar(bar(1,2),3)
# print(rest)
# print(reat1)
#
# def aa():
# print("penfe")
#
# def bb(x,y):
# res=x if x>y else y
# return res
#
# print(bb(1,2))
# 函数可以输出多个值,以元组的方式返回
# x=3
# y=1
# def bar(x,y):
# return 1,2,[3,4],{5,7,8}
#
# res1=bar(x,y)
# print(res1)
# 只取某个值,但下面的方法有些低端
# x,e,r,t,y='hessl'
# print(r)
#
# x,_,_,_,y='hessl'
# print(y)
#
# x,*_,y=[1,2,3,4,5,6]
# print(y)
#
# # 只取最后一个字符
# *_,y=[1,2,3,4,5,6]
# print(y)
#
# # 只取第一个字符
# x,*_=[1,2,3,4,5,6]
# print(x)
#
# # 函数可以输出多个值,以元组的方式返回
# x=3
# y=1
# def bar(x,y):
# return (1,2,[3,4],{5,7,8})
#
# res1=bar(x,y)
# print(res1)
# a,b,c,d=bar(x,y)
# print(a)
# print(b)
# print(c)
# print(d)
# def my_max():
# name=input("输入名字:")
# pwd=input("密码:")
# if name=="jensen" and pwd=="123":
# print("登录成功")
# else:
# print("登录失败")
#
# my_max()
# def nn(x,y):
# '''x->int,y->int,res=int'''
# res=x if x>y else y
# return res
#
# print(nn(1,2))
# def nn(x:int,y:int)->int:
# '''x->int,y->int,res=int'''
# res=x if x>y else y
# return res
#
# print(nn(1,2))
# print(nn.__annotations__)