def get_max(a, b):
"""比较a和b的大小"""
if a > b:
print(a, "比较大")
else:
print(b, "比较大")
get_max(5, 20)
def connect(ip, port):
"""连接设备"""
print(f"设备{ip}:{port}连接")
connect(ip="127.0.01", port=8080)
print("-------默认的传递--------")
def connect(ip, port=8080):
"""连接设备"""
print(f"设备{ip}:{port}连接")
connect(ip="127.0.02")
connect(ip="127.0.03", port=3306)
print("--------打包---------")
def test(a, b, c, d, e):
print(a, b, c, d, e)
nums = (12, 22, 33, 44, 55)
test(*nums)
nums = {"a": 12, "b": 22, "c": 33, "d": 44, "e": 55}
students = []
def show_menu():
"""显示学生管理系统菜单"""
print("-------------------------")
print("|1.添加学生信息")
print("|2.查询学生信息")
print("|3.退出系统")
print("----------------------------------")
def add_student(name, age, grade, student_id =None):
if student_id is None:
student_id = len(students) + 1001
student = {
"name":name,
"age":age,
"grade":grade,
"id":student_id
}
students.append(student)
print(f"成功添加学生:{name}(id:{student_id})")
show_menu()
choice = input("请输入您的选择: ")
show_menu()