[Tutor] (no subject)
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Sun Sep 25 08:56:39 CEST 2005
On Sat, 24 Sep 2005 Goofball223 at wmconnect.com wrote:
> How would I get the following program to accept inputs of exam scores
> from 0-100 with A being 100-90, B being 89-80, C being 79-70, D being
> 69-60, and F being everything less than 60?
Hello,
Are you familiar with "if/elif/else"? These "control-flow" statements
should help you express the above grading idea fairly straightforwardly.
For experienced programmers, there is a module in the Standard Library
that does pretty much what you want. I'll link to it below, but you
probably won't want to use it: learn to use if/elif/else first; I'd hate
to stunt your Python learning. *grin*
Link for experienced programmers:
http://www.python.org/doc/lib/bisect-example.html
More information about the Tutor
mailing list