weixin_57356052
2021-06-21 11:14
采纳率: 33.3%
浏览 45

python,统计班级平均分

 

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • 已采纳
    score=[78,65,90,100,50,85,62,70,60,80]
    x=int(input())
    score.append(x)
    sum=0
    for i in score:
            sum+=i
    avg=sum/11
    print("%.1f"%(avg))
    score=sorted(score)
    score=reversed(score)
    for i in score:
            if i>avg:
                    print(i)

    点赞 打赏 评论
  • 奋斗的小小鱼 2021-06-21 11:24
    scores=[78,65,90,100,50,85,62,70,60,80]
    #1
    scores.append(20)
    print(scores)
    #2
    Total_score=0
    for i in scores:
        Total_score+=i
    average = Total_score/len(scores)
    print("%.1f"%average)
    #3
    for j in scores:
        if j>average:
            print(j,end=' ')
    点赞 打赏 评论

相关推荐 更多相似问题