473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Loops and Lists problem

16
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
Jun 25 '07 #1
1 1004
bvdet
2,851 Expert Mod 2GB
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:
Expand|Select|Wrap|Line Numbers
  1. scores = [1,2,3,4,0,1,-2,-3,4,-5,6,-6,4,3,-2,1,4,2,-1,-2]
  2. no_scores = len(scores)
  3. total_score = sum([score for score in scores if score >= -5 or score <= 5])
  4. average_score = total_score/float(no_scores)
Jun 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Michele Simionato | last post by:
I have read with interest the recent thread about closures. The funny thing is that the authors are arguing one against the other but I actually agree with all of them and I have a proposal that...
1
by: Bulba! | last post by:
OK. I have reworked this program (below) to use just the data manipulation capabilities of Python (training was largely the motivation). I've tried to manipulate the data just in Python and not in...
46
by: Neptune | last post by:
Hello. I am working my way through Zhang's "Teach yourself C in 24 hrs (2e)" (Sam's series), and for nested loops, he writes (p116) "It's often necessary to create a loop even when you are...
4
by: Bill Moran | last post by:
I've got a bit of a strange problem that's causing me some MAJOR headaches. I'm developing the server-side of a large database application in PostgreSQL. This consists of a C daemon, and a LOT...
12
by: Sheldon | last post by:
Hi, I have two arrays that are of the same dimension but having 3 different values: 255, 1 or 2. I would like to set all the positions in both arrays having 255 to be equal, i.e., where one...
12
by: Rich Shepard | last post by:
I want to code what would be nested "for" loops in C, but I don't know the most elegant way of doing the same thing in python. So I need to learn how from you folks. Here's what I need to do: build...
16
by: lisa.engblom | last post by:
I have two semi related questions... First, I am trying to output a list of strings to a csv file using the csv module. The output file separates each letter of the string with a comma and then...
0
gits
by: gits | last post by:
This little article will show you how to optimize runtime performance when you need to compare two arrays (a quite common task). Have a close look at the entire article, and you will see the...
1
by: Tommy Grav | last post by:
Hi everyone, I have a list of objects where I have want to do two loops. I want to loop over the list and inside this loop, work on all the elements of the list after the one being handled in...
5
by: imish06 | last post by:
This is the question: "The user must enter a non-negative number to add to the lists or a negative number to stop the program. For every non-negative number entered, place each even and odd...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.