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']-
Notifications
You must be signed in to change notification settings - Fork 0
coderlxn/PythonDemos
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
Python的小demo,用于展示Python编程的小技巧
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published