473,215 Members | 1,238 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,215 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 1000
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: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.