Question

In: Computer Science

Averaging measurements: Use python 3 to write this program Assume that someone has collected a set...

Averaging measurements: Use python 3 to write this program

Assume that someone has collected a set of measurements and wants some statistical data about them. Write a program that asks a user for measurements and prints the average, the maximum, and the minimum measurement. Users should be allowed to enter as many measurements as they want, until entering a negative measurement. The negative measurement should not be processed, but is just used to indicate that the user has finished entering measurements. [Note: do not use a list to store the measurements.]

Note: Complete without using import sys. Only use simple for and while loops and if else statements.

Solutions

Expert Solution

HOPE THIS ANSWER SATISFIES YOUR QUERY. IF I MISSED SOMETHING PLEASE DO MENTION IN THE COMMENTS AND ALSO PLEASE RATE THE ANSWER. I HAVE ALSO ATTACHED THE SCREENSHOT OF THE CODE ALONG WITH THE OUTPUT FOR BETTER UNDERSTANDING.
THANKS

*********CODE STARTS HERE***************

sum1 = 0
count = 0
maxx = 0
minn = 100000000
input1 = 1 #initial value of input > 0
while input1>0:
input1 = int(input())
if input1<0: #if input is negative breaks out of loop
break
sum1 = sum1+ input1 #sum is added on every iteration
count = count+1 #count is added on every iteration

if input1>maxx:
maxx = input1 #max is calculated
  
if input1<minn:
minn = input1 #min is calculated

print("Average is: " , sum1/count)
print("maximum is ", maxx)
print("Minimum is ", minn)

**********CODE ENDS HERE****************

​​​​​​​


Related Solutions

b) Assume that someone has collected a set of measurements and wants some statistical data about...
b) Assume that someone has collected a set of measurements and wants some statistical data about them. Write a program that asks a user for measurements and prints the average, the maximum, and minimum measurement. User should be allowed to enter as many measurements as they want, until entering a negative measurement. The negative measurement should not be processed, but is just used to indicate that the user has finished entering measurements. (Do not use a list to store the...
for Python 3 Write a python program that Creates a list that has these values in...
for Python 3 Write a python program that Creates a list that has these values in this order, 'Python', 'JavaScript', and 'PHP' Define a displayMyClasses function that sorts the list and then displays each item on the list, one per line, in sorted order. Also, number the displayed list as shown in the "Running a Sample Program" shown below. Define a guessNext function that selects a random element from the list and returns it to the call of the function....
Use Python 3, please type. Write a Python 3 program which is an arithmetic quiz for...
Use Python 3, please type. Write a Python 3 program which is an arithmetic quiz for children. The program asks the user to calculate the multiplication of two numbers generated at random in your code. The numbers should be in the range 1 through 10. User input is shown in bold black font in the example below. You will need to use random numbers. You should type the recommended comments at the top of your code and include three test...
USE Python 3, please type thanks! Write a Python 3 program to calculate the Body Mass...
USE Python 3, please type thanks! Write a Python 3 program to calculate the Body Mass Index (BMI) of a person if they enter their weight and their height to your program. Check out the formula here: http://www.freebmicalculator.net/calculate-bmi.php Your program should first print "Body Mass Index Calculator" The program will then ask the user if they want to enter Metric Units or English Units. Using the appropriate formula (see link above) calculate their BMI. Depending on their BMI show their...
Beginning Python Programming - Sorting: Write and test a Python program to print a set of...
Beginning Python Programming - Sorting: Write and test a Python program to print a set of real numbers in descending order. The program should also print out the median of the numbers input and how many numbers were input. The program should read in numbers until a negative number is read. The negative number serves as a sentinel or marker telling the program when to stop reading numbers. The program should then sort the numbers and print them out in...
IN PYTHON Write a program to do the following: Solve the a set of equations as...
IN PYTHON Write a program to do the following: Solve the a set of equations as mentioned in "Zybook 5.20 LAB: Brute force equation solver". Instead of the arithmetic operators use your own function defined in a module named calc. You must provide two files (calc.py, brute_force_solver.py) :- 1) calc.py:- Add function named 'add' instead of using operator '+' [10pts] Add function named 'difference' instead of using operator '-' [10pts] Add function named 'product' instead of using operator '*' [10pts]...
Can someone do this python program? Write a function that takes a number as a parameter...
Can someone do this python program? Write a function that takes a number as a parameter and then prints out all of the factors for that number.
Write a program IN PYTHON of the JUPYTER NOOTBOOK that keeps getting a set of numbers...
Write a program IN PYTHON of the JUPYTER NOOTBOOK that keeps getting a set of numbers from user until the user enters "done". Then shows the count, total, and average of the entered numbers. This should the answer when finished Enter a number: 55 Enter a number: 90 Enter a number: 12 Enter a number: done You entered 3 numbers, total is 157, average is 52.33333
Write a program in python that reads the elements of a set from the keyboard, stores...
Write a program in python that reads the elements of a set from the keyboard, stores them in a set, and then determines its powerset. Specifically, the program should repeatedly ask the user: Enter one more element ? [Y/N] If the user answers Y then an new element is read from the keyboard: Enter the new element in the set: This cycle continues until the user answers N to the first question. At that point the program shall compute the...
Use Python ## Problem Set 3 - James is looking for his dream job, but has...
Use Python ## Problem Set 3 - James is looking for his dream job, but has some restrictions. He loves California and would take a job there if it paid over 40,000 a year. He hates Massachusetts and demands at least 100,000 to work there. Any other place he’s content to work for 60,000 a year, unless he can work in space in which case he would work for free. - Write a program to capture the above statement -...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT