On Wed, 12 Oct 2005 [EMAIL PROTECTED] wrote:

> below is my code and everytime I input a value of 16 or more it keeps
> returning sophomore. could anyone help me figure out what to change so
> that it won't return sophmore for things greater than or equal to 16?

If we have the following:

### Pseudocode
if A:   [bodyA]
elif B: [bodyB]
elif C: [bodyC]
else:   [bodyD]
###############

only of those bodies will be entered, regardless if more than one
condition is true.  That is, we'll enter the body of the first condition
that ends up true, and ignore the rest.  We call this an "exclusive"
branching point for this reason.

If it helps, the above pseudocode could also be rewritten as the following
(although it would not be idiomatic):

if A:
    [bodyA]
else:
    if B:
        [bodyB]
    else:
        if C:
            [bodyC]
        else:
            [bodyD]

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

Reply via email to