On Sat, Oct 4, 2008 at 10:31 AM, Brian C. Lane <[EMAIL PROTECTED]> wrote:

>    for g in grades:
>        if (score <= g[1]) and (score >= g[0]):
>            return g[2]

I think tuple unpacking makes code like this more readable:

for lower, upper, grade in grades:
  if lower <= score <= upper:
    return grade

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to