Loops and Lists problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kasrav
    New Member
    • Apr 2007
    • 16

    Loops and Lists problem

    Hey guys thanks for the help so far about all the problems i have been bringing on this forum. I got this problem i cant figure out how to start this program, its about collectnig student survey feedback regarding the quality of a programming unit. Each score is between -5 (hopeless) to + 5 (excellent). There are 20 scores to be input. If a particular score is outside the range -5 to +5 it is assumed to be spoiled, and a mark of 0 is used instead.

    This is the confusing bit to calculate the average score and report on the quality of the unit, based on the average score. If the score is less than -3, report “bad”, if less than 0 “poor”, if 0 “average”, if less than or equal to 3 “quite good”, if more than 3, “excellent”.

    Thanks
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Originally posted by Kasrav
    Hey guys thanks for the help so far about all the problems i have been bringing on this forum. I got this problem i cant figure out how to start this program, its about collectnig student survey feedback regarding the quality of a programming unit. Each score is between -5 (hopeless) to + 5 (excellent). There are 20 scores to be input. If a particular score is outside the range -5 to +5 it is assumed to be spoiled, and a mark of 0 is used instead.

    This is the confusing bit to calculate the average score and report on the quality of the unit, based on the average score. If the score is less than -3, report “bad”, if less than 0 “poor”, if 0 “average”, if less than or equal to 3 “quite good”, if more than 3, “excellent”.

    Thanks
    Maybe this will get you started:[code=Python]scores = [1,2,3,4,0,1,-2,-3,4,-5,6,-6,4,3,-2,1,4,2,-1,-2]
    no_scores = len(scores)
    total_score = sum([score for score in scores if score >= -5 or score <= 5])
    average_score = total_score/float(no_scores )[/code]

    Comment

    Working...