Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

WilsonWorla

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?

  • one year ago
  • one year ago

  • This Question is Closed
  1. benjaminf
    Best Response
    You've already chosen the best response.
    Medals 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.

    • one year ago
    • Attachments:

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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.