How can i accomplish this? IF statement. fast reply.!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jihad4u
    New Member
    • Apr 2008
    • 1

    How can i accomplish this? IF statement. fast reply.!!

    assuming i have data for students names,credit hours, totalpoint or qualitypoints. i have trouble with both counting that is total number of students who fall under each category. printing students.

    To do:
    Count and print the number of students in each classification. Use the following classification scheme:
    0-31 credits Freshman
    32-63 credits Sophomore
    64-95 credits Junior
    over 96 credits Senior
  • Laharl
    Recognized Expert Contributor
    • Sep 2007
    • 849

    #2
    What you seem to need is the if: elif: else: setup. It works like this:

    [CODE=python]
    if condition:
    #do stuff
    elif condition:
    #do other stuff
    #elif is short for else if, so it's only checked if the 'if' was false
    #any number of elif blocks can be associated with a single if
    else:
    #do the stuff that happens if none of the above are true
    [/CODE]

    Comment

    Working...