python数据结构列表

img


已知列表元素的关系为,索引为偶数的元素代表学生名字,索引为奇数的元素代表该学生成绩。

请问优秀和不合格是多少分?我这里设成 90 和 60,不一样的话你改改吧:

list1 = ['李梅', 80, '陈才', 95, '张文曦', 95]

# 1
list1.extend(['张文辉', 48, '李广利', 79])
print(list1)

# 2
for i in range(0, len(list1), 2):
    student, score = list1[i:i+2]
    if score > 90 or score < 60:
        print(student)