A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • 4 years ago

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?

  • This Question is Closed
  1. anonymous
    • 4 years ago
    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.

  2. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

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


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