hello,
i am definitely on an entry level basis with programming. i just recently learned how to write a simple program in my class. for some reason i am having a difficult time with this problem:
A college wants you to write a program for them that will calculate the AVERAGE number of wins for their football team over the past FIVE years. the program user should be able to enter the number of wins each year. the program will calculate the average number of wins during that five year period and display that information to the screen.
i am using PYTHON GUI.
here is what i think i know:
season1=input("season1.")
season2=input("season2.")
season3=input("season3.")
season4=input("season4.")
season5=input("season5.")
average = (season1 + season2 + season3 + season4+ season5) /5
print 'the average is', average
by using these lines it is still not working. can anyone give me some advice? throw me a bone? im pulling my hair out here trying to figure it out myself.
thank you!
"Average" or "sum of" on python programming
Page 1 of 13 Replies - 14701 Views - Last Post: 30 March 2009 - 03:02 PM
Replies To: "Average" or "sum of" on python programming
#2
Re: "Average" or "sum of" on python programming
Posted 28 March 2009 - 02:48 PM
If haven't mentioned what type of error you are having. If you just need to have the average with decimal point, then you can divide the sum with 5.0 instead of 5.
Or, if you are using python 3.0 or latest version, then probably your program is getting an error. Because print isn't a statement there, it is a function. For that case, you can do-
Is it ok now? Let us know if you still having problem with what type of error you are getting.
season1=input("season1.")
season2=input("season2.")
season3=input("season3.")
season4=input("season4.")
season5=input("season5.")
average = (season1 + season2 + season3 + season4+ season5) /5.0
print 'the average is', average
Or, if you are using python 3.0 or latest version, then probably your program is getting an error. Because print isn't a statement there, it is a function. For that case, you can do-
season1=input("season1.")
season2=input("season2.")
season3=input("season3.")
season4=input("season4.")
season5=input("season5.")
average = (season1 + season2 + season3 + season4+ season5) /5
print ('the average is', average)
Is it ok now? Let us know if you still having problem with what type of error you are getting.
#3
Re: "Average" or "sum of" on python programming
Posted 29 March 2009 - 09:49 PM
hey r u itt tech if so im me i was in python last quarter and have alot of the work [removed]
#4
Re: "Average" or "sum of" on python programming
Posted 30 March 2009 - 03:02 PM
David,
I've edited out your email address. 1) We don't allow that sort of collaboratoin (i.e. giving people the solutions to homework) and 2) You'll end up getting spammed.
As an aside, I think there might be something wrong with your keyboard. Or you were visiting us from your cell phone. One or the other.
I've edited out your email address. 1) We don't allow that sort of collaboratoin (i.e. giving people the solutions to homework) and 2) You'll end up getting spammed.
As an aside, I think there might be something wrong with your keyboard. Or you were visiting us from your cell phone. One or the other.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|