Coder Social home page Coder Social logo

Comments (4)

qiwsir avatar qiwsir commented on August 24, 2024

ok. Thank you very much. I have corrected it.

from starterlearningpython.

loveofmaria avatar loveofmaria commented on August 24, 2024

from future import division

def stat(ls):
new_ls = sorted(ls.items(),key=lambda d:d[1],reverse=True) #所有成绩从高到低排列
cj_list = tuple([x for x in ls.values()])
ave = sum(cj_list)/len(cj_list) #平均成绩
cj_max = max(tuple(cj_list)) #最高成绩分数值
cj_min = min(tuple(cj_list)) #最低成绩分数值
print("本次成绩从高到低排列如下:")
for x,y in new_ls:
print ("%s:%d" % (x,y))
print ("---------------------------------------------------------------------------------------")
low_list = {i:ls[i] for i in ls.keys() if ls[i] == cj_min} #所有成绩为最低的
high_list = {i:ls[i] for i in ls.keys() if ls[i] == cj_max}#所有成绩为最高的
print ("最低成绩的人是:")
print (low_list)
print ("---------------------------------------------------------------------------------------")
print ("最高成绩的人是:")
print (high_list)
print ("---------------------------------------------------------------------------------------")
print ("平均成绩为:%d" % ave)

if name == "main":
scores ={'zhangmazi':49,'wanger':99,'longfei':99,'gaoma':40,'huanglong':40,'chenrong':65,'zhanggang':77,'liujia':89,'tianzhigang':91,
'ganwenzi':99,'zhanglian':67,'zhouchun':40,'luoxiaoxiao':59}
stat(scores)

from starterlearningpython.

loveofmaria avatar loveofmaria commented on August 24, 2024

我总觉得自己的思路有问题
每次总把所有要实现的功能写到一起,不会'分治'

from starterlearningpython.

qiwsir avatar qiwsir commented on August 24, 2024

you can send your code to me, or to QQ

from starterlearningpython.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.