subject

Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate 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
BASE CODE

theSum = 0.0
data = input("Enter a number: ")
while data != "":
number = float(data)
theSum += number
data = input("Enter the next number: ")
print("The sum is", theSum)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:20
The liang book has an example called which is a javafx application that reads the javabook database using a preparedstatement object. using it as a guide, create a similar application called findbooks. it will read a list of authors from the bookdb created in problem 1 and display them in a listview. if the user selects an author, it should display the author's book titles in a textarea.
Answers: 2
question
Computers and Technology, 22.06.2019 00:30
Jenny wants to look at row 345 and compare it to row 17. what can she do if she wanted to easily adjust to see both at once?
Answers: 3
question
Computers and Technology, 22.06.2019 19:00
Stacy works as blank. the most important soft skill she needs for this role is blank.
Answers: 3
question
Computers and Technology, 22.06.2019 19:50
Write a car class having two private member variables called tank and speed. write public methods called pumpgas and gofast. the method pumpgas gets an integer for gas that must be pumped. that value needs to be added to tank (no more than 20 gallons). it must return the amount of gas that is purchased ($4 per gallon). the method gofast should increase the speed by 5 each time it is called.write a constructor for the above class that initialized both variables to zero.write a tostring to display both the tank and speed when the car is printed.modify the car class to implement the interface comparable and an interface called carinter having the public methods in carinter.write the main program to create an array of size 5 of type car. create 5 car objects having each location of the array to refer to one of the cars. test the pumpgas, gofast, equals method on the array items. write an enhanced loop to print all the car values (using a tostring written last time).write a generic method to find the minimum of four items. pass int, double, char, string and car objects to test this method.
Answers: 1
You know the right answer?
Write a program that receives a series of numbers from the user and allows the user to press the ent...
Questions
question
Mathematics, 12.11.2020 14:00
question
Mathematics, 12.11.2020 14:00
question
Mathematics, 12.11.2020 14:00
question
Mathematics, 12.11.2020 14:00
question
Mathematics, 12.11.2020 14:00
Questions on the website: 13722363