Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
WilsonWorla
Group Title
n = int(input ("enter the number input; "))
sumN = 0
for nCount in range(n):
inputNumber = int(input("Enter your next number; "))
sumN += inputNumber
average = sumN/n
print "The sum of the number is; ",sumN
print "The average of the number is; ",average
Can anybody explain this to me?
 2 years ago
 2 years ago
WilsonWorla Group Title
n = int(input ("enter the number input; ")) sumN = 0 for nCount in range(n): inputNumber = int(input("Enter your next number; ")) sumN += inputNumber average = sumN/n print "The sum of the number is; ",sumN print "The average of the number is; ",average Can anybody explain this to me?
 2 years ago
 2 years ago

This Question is Closed

benjaminf Group TitleBest ResponseYou've already chosen the best response.0
So this looks like some kind of pseudocode that outlines a process for calculating the average of a series of numbers entered by the user. I.e. \[x _{avg} =\frac{ 1 }{n } \sum_{i=1}^{n} x _{i} \] It looks like the series is 'n' numbers long and that is chosen by the user in: n = int(input ("enter the number input; ")) You also have a variable sumN that starts at 0. Then it looks like you are using some function called 'nCount in range' to keep track of how many numbers the user has entered (that function isn't defined here) but presumably while nCount is less than n you will stay within the 'for' structure prompting the user to enter numbers and adding them to sumN. When you leave the 'for' structure you define a new variable 'average' that gives the average of the series of numbers entered (see eqn.) and you print that average as well as sumN.
 2 years ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.