
February 12th, 2013, 06:36 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 1
Time spent in forums: 6 m 24 sec
Reputation Power: 0
|
|
|
A small program to compute averages
I am currently taking a python programming class and we are working on a program that requires finding averages of some values from an imported file, but I am having some issues creating a while or for loop that can compute averages.
Lets say I have a list newlist = [1, 2, 3, 4, 5]
I want to create a loop that will compute the mean of these values, which of course is 3. I know I will need a few variables but I do not know how to utilize them. Of course, I will need to convert the values in newlist to integers as well.
Does anyone know how to do something like this with basic syntax? Of course we have covered conditionals, while loops, for loops, string methods, booleans, etc, but I just cannot seem to make a program that will find the average and print it out.
Some help would be appreciated!
Thanks!
|