1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nataly_w [17]
1 year ago
8

Edit the program provided so that it receives a series of numbers from the user and allows the user to press the enter key to in

dicate that he or she is finished providing inputs. After the user presses the enter key, the program should print:
The sum of the numbers
The average of the numbers
An example of the program input and output is shown below:

Enter a number or press Enter to quit: 1
Enter a number or press Enter to quit: 2
Enter a number or press Enter to quit: 3
Enter a number or press Enter to quit:

The sum is 6.0
The average is 2.0

This is what I have but it just keep going with the numbers
# Edit the code below
theSum = 0.0
count = 0
while True:
number= input("Enter a number or press Enter to quit:")
if number=="":
break
theSum+=float(number)
count+=1
print("The sum is", theSum)
if count>0:
print("The average is ", theSum/count)
Computers and Technology
1 answer:
BlackZzzverrR [31]1 year ago
8 0

The edited and complete program is as follows

theSum = 0.0

count = 0

while True:

   number= input("Enter a number or press Enter to quit:")

   if not number:

       print("The sum is", theSum)

       if count>0:

           print("The average is ", theSum/count)

       exit()

   theSum+=float(number)

   count+=1

<h3>How to edit the program?</h3>

The complete program that calculates the average and the sum of numbers entered by the user is as follows:

Note that the program ends when the user presses the enter key and comments are used to explain each line

#This initializes the sum

theSum = 0.0

#This initializes the counter

count = 0

#This ensures the user enters numbers repeatedly

while True:

   #This gets the input

   number= input("Enter a number or press Enter to quit:")

   #When the user presses enter

   if not number:

       #This prints the sum and the average

       print("The sum is", theSum)

       if count>0:

           print("The average is ", theSum/count)

       #This exits the program

       exit()

   #This calculates the sum

   theSum+=float(number)

   count+=1

Read more about python programs at

brainly.com/question/26497128

#SPJ1

You might be interested in
What happens once the Insert tab is used in PowerPoint to insert a chart into a presentation?
nordsb [41]

Answer:

•The user can edit the chart directly. hoped i;m right

Explanation:

6 0
3 years ago
Which is an example of a variable name written in camelcase?
NemiM [27]

Answer:

Option (a) myCar

Explanation:

Option (a) is Correct

If there are two or more words in variable we can use camel case to declare the variable. In camel case first character of first word is either a lowercase alphabet or underscore (_) and first character of second word is a uppercase alphabet. ex: empNum, myCar

So the Option (a) myCar is correct among the given options

Option (b) is incorrect

Since both the first letter of two words are in lower case which is not according to camel case rules

Option (c) is incorrect

The first letter of first word is in lower case first character of second word is a uppercase alphabet but there is a gap so it is not valid .

Option (d) is incorrect

The first word is in upper case and first character of second word is a uppercase alphabet it is not valid.

6 0
3 years ago
Read 2 more answers
After you enter the details for the first selected recipient in the New Address List dialog box, click _______ to add another re
lianna [129]

Answer: New Entry

Explanation:

Upon clicking the new entry button given at the bottom we are able to add another recipient  in the New Address List dialog box.

The new entry button clears the text fields to enter new details

3 0
3 years ago
Read 2 more answers
How do i install java runtime environment?
nlexa [21]
Just go to the internet and download the file and install
please mark as brainliest

3 0
3 years ago
What should htc's os strategy be? should it stick with windows mobile and android? should htc build its own platform? add/drop o
rosijanka [135]

I say windows, since it is very common.

8 0
3 years ago
Other questions:
  • For homework, we have to figure out what's in the picture. It's " too close to tell " but I can't figure out what it is. Any ide
    11·1 answer
  • Which protocol is used by the client for microsoft networks and file and printer sharing for microsoft networks to communicate w
    10·1 answer
  • Please help me
    10·1 answer
  • What is an elliptic curve cryptosystem (ECC)?
    8·1 answer
  • ou are working as a technician on a computer loaded with MS Windows. You boot the computer that has an incorrect driver loaded f
    12·1 answer
  • Given the function F (X, Y , Z)=Σm(0,1, 2 , 4 , 6)
    13·1 answer
  • Write a procedure ConvertToBinary that takes an input as a number from 0 to 16 (including 0 but not 16) and converts it to a bin
    11·1 answer
  • What is a feature of readable code?
    12·2 answers
  • Explain why the computer is powerful working tool???​
    7·1 answer
  • What is cloud based LinkedIn Automation?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!