Skip to content

coderlxn/PythonDemos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

根据一个分数找到对应的成绩

import bisect

def grade(socre, breakpoints=[60, 70, 80, 90], grades="FDCBA"):
	i = bisect.bisect(breakpoints, socre)
	return grades[i]
[grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]
# ['F', 'A', 'C', 'C', 'B', 'A', 'A']

About

Python的小demo,用于展示Python编程的小技巧

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published