[Tutor] cases with single if and an else clause

Manprit Singh manpritsinghece at gmail.com
Wed Oct 6 12:01:04 EDT 2021


So...once again ...many many thanks to Dennis ....and Alan sir .

Today .it was something ..that made me to think...differently ..

Upto this ..point ...I was habitual of writing longer if else inside
functions ..but today's...mail of Dennis...has taught me so many things...

And...I am not a programmer ..python ...is just my hobby...just...to
say...I am glad...I am learning it day by day.


Regards
Manprit Singh

On Wed, 6 Oct, 2021, 21:13 Dennis Lee Bieber, <wlfraed at ix.netcom.com> wrote:

> On Wed, 6 Oct 2021 16:34:43 +0530, Manprit Singh
> <manpritsinghece at gmail.com> declaimed the following:
>
> >
> >I  saw your explanation about my question :
> >GRADES = [ (60, "F"),
> >           (70, "D"),
> >           (80, "C"),
> >           (90, "B"),
> >           (100, "A") ] #ordered list of breakpoints
> >
> >These were the grades you have used, There is a problem, See if the marks
> >are 60 That should not be classified as F . The pattern must be like as
> >follows :
> >
> >if marks >=90   and  <= 100  ---- "A" Grade
> >else marks >= 80 and  < 90  ----  "B" Grade
> >else marks >= 70 and  < 80  ----  "C" Grade
> >else marks >= 60 and <  70  ----  "D" Grade
> >else marks below 60 ---- "F" or Fail
>
>         Using those ranges means that "A" is achieved for 11 scores, but
> "B",
> "C", and "D" are only achieved for 10 scores each -- an imbalance (or bias)
> in distributing letter grades.
>
> A       90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100
> B       80, 81, 82, 83, 84, 85, 86, 87, 88, 89
> (with the B pattern applied to C and D)
>
>         The break points I used mean that each letter grade A..D has only
> 10
> matching scores -- with F absorbing everything below (including the fact
> that 0..100 spans 101 distinct scores; logically one might expect 0..99 or
> 1..100 <G>).
> .
>
>
> --
>         Wulfraed                 Dennis Lee Bieber         AF6VN
>         wlfraed at ix.netcom.com
> http://wlfraed.microdiversity.freeddns.org/
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list