Computer Science, asked by vsdhiman85, 2 months ago

Write a program that reads numbers from the user until a blank line is entered. Your program should display the average of all of the values entered by the user. Then the program should display all of the below average values, followed by all of the average values (if any), followed by all of the above average values. An appropriate label should be displayed before each list of values.

Answers

Answered by ry0824282
0

Answer:

Python program to take input while blank line

and prints recursive total

# This function takes input recurrsively until it finds blank line and gives total of all numbers

def recursiveUntilBlank():

inp = raw_input() # Get the input

if inp == : # If it is a blank line...

return 0.0

else: # recurssive call and add value in previous result

return float(inp) + recursiveUntilBlank()

# declare main function

def...

Answered by jaya8765
1

Answer:

Program that reads numbers from the user until a blank line is entered. Your program should display the average of all of the values entered by the user. Then the program should display all of the below average values, followed by all of the average values (if any), followed by all of the above average values. An appropriate label should be displayed before each list of values.

print("Input some integers to calculate their average. Input 0 to exit.")

count = 0

sum = 0.0

number = 1

while number != 0:

number = float(input(""))

sum+ = numbers

count += 1

if count == 0:

print("Input some numbers")

else:

print("Average of the above numbers are: ", sum / (count-1), sum)

Output:

Input some integers to calculate their average. Input 0 to exit

.                                                                      

15                                                                    

16                                                                    

12                                                                    

0                                                                      

Average of the above numbers are:  10.75555555555555

Explanation:

Here the average of the given number =  sum of elements ÷ number of elements

In the first iteration of the program it takes the number value as 1

if the given number is not equal to 0 the the while block is executed or else the else block is executed

To know more about coding languages visit the links given below:

https://brainly.in/question/20277329

https://brainly.in/question/8787811

Similar questions