Python每日练习

2ffaadcb0e304221aa9e1b9336508350.png

 

77de0d1b56124d699f2c1bb6e558f32d.png 

 

#计算机挑战赛--学科竞赛
people = int(input('输入想要参赛的人数:\n'))
subject = input('想要参加选拔的科目:\n')
list = [];total = 0;marks = [];
for i in range(people):
    id,g1,g2,g3,g4,g5,g6 = map(int,input().split())
    list.extend([[id,g1,g2,g3,g4,g5,g6]])
if subject == 'I':
    for i in range(people):
        List = list[i]
        x = List[2]
        y = List[3]
        new_total = x + y
        marks.append(new_total)
    count = marks.count(max(marks))
    if count == 1:
        List1 = list[marks.index(max(marks))]
        print(List1[0])
    else:
        List3 = []
        position = [index for index,value in enumerate(marks) if value == max(marks)]
        print(position)
        for i in position:
            List2 = list[i]
            List3.append(List2[0])
        List3.sort()
        print(List3)
        for i in List3:
            print(i)
if subject == 'B':
    for i in range(people):
        List = list[i]
        x = List[2]
        y = List[4]
        new_total = x + y
        marks.append(new_total)
    count = marks.count(max(marks))
    if count == 1:
        List1 = list[marks.index(max(marks))]
        print(List1[0])
    else:
        List3 = []
        position = [index for index,value in enumerate(marks) if value == max(marks)]
        for i in position:
            List2 = list[i]
            List3.append(List2[0])
        List3.sort()
        for i in List3:
            print(i)
if subject == 'H':
    for i in range(people):
        List = list[i]
        x = List[5]
        y = List[6]
        new_total = x + y
        marks.append(new_total)
    count = marks.count(max(marks))
    if count == 1:
        List1 = list[marks.index(max(marks))]
        print(List1[0])
    else:
        List3 = []
        position = [index for index,value in enumerate(marks) if value == max(marks)]
        for i in position:
            List2 = list[i]
            List3.append(List2[0])
        List3.sort()
        for i in List3:
            print(i)

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值