python语言篇(9练习1)

# 01_lambda.py

# 1. 写一个lambda表达式, 判断这个数的2次方+1 能否被5整数,如果能整除返回True, 否则返回False

#    fx = lambda n: .......
#    print(fx(4))  # False
#    print(fx(3))  # True

fx = lambda n: (n ** 2 + 1) % 5 == 0

print(fx(4))  # False
print(fx(3))  # True
 

# 2. 写一个lambda 表达式,求两个变量的最大值:
#   mymax = lambda ...
#   print(mymax(55, 63))  # 63


# mymax = lambda x, y: max(x, y)
mymax = lambda x, y: x if x > y else y

print(mymax(55, 63))  # 63

# student_info.py


def input_student():
    pass


def output_studnet(lst):
    pass


L = input_student()  # 输入学生信息形成字典列表
print(L)
output_studnet(L)  # 打印学生信息表格

猜你喜欢

转载自blog.csdn.net/Jason_Edison/article/details/88891522