Question

I need to create a Phyton program 1. Contains the following steps:    a) Create a...

I need to create a Phyton program

1. Contains the following steps:

   a) Create a loop where you prompt the user to enter integers and calculate the average of the numbers entered. Exit the loop when the entered number is 0.

   b) Test Program_A works as designed.

   c) Use as a template Program_A, create a new file Program_B which uses a similar loop and calculates the max in the list.

   d) Test Progam_B

0 0
Add a comment Improve this question Transcribed image text
Answer #1

total = 0
count = 0
n = float(input("Enter number: "))
while(n!=0):
    total += n
    count += 1
    n = float(input("Enter number: "))
print("Average:",(total/count))

Output:

n = float(input("Enter number: "))
maxValue = None
while(n!=0):
    if maxValue==None or maxValue<n:
        maxValue = n
    n = float(input("Enter number: "))
print("Max in list is:",(maxValue))

Output:

Add a comment
Know the answer?
Add Answer to:
I need to create a Phyton program 1. Contains the following steps:    a) Create a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using Java Create an application that creates and displays a list of names using an array....

    Using Java Create an application that creates and displays a list of names using an array. Then modify the application to create and use a list of numbers. Console for the names application Please enter a name or type “exit” to quit: Diane Please enter a name or type “exit” to quit: Joe Please enter a name or type “exit” to quit: Greta Please enter a name or type “exit” to quit: Henry Please enter a name or type “exit”...

  • CPT 180 Chapter 2 Assignment 3 Directions Using the following guidelines, create a python program. 1....

    CPT 180 Chapter 2 Assignment 3 Directions Using the following guidelines, create a python program. 1. Create a program named printRandomNumbers that gets input from the user and then produces a list of random numbers. 2. Import the random module 3. Add three comment lines at the top of the program that contain: a. Program Name b. Program Description c. Programmer's Name (You) 4. Prompt the user for the following: a. Number of random numbers required b. Lower limit of...

  • Description: Create a program called numstat.py that reads a series of integer numbers from a file...

    Description: Create a program called numstat.py that reads a series of integer numbers from a file and determines and displays the name of file, sum of numbers, count of numbers, average of numbers, maximum value, minimum value, and range of values. Purpose: The purpose of this challenge is to provide experience working with numerical data in a file and generating summary information. Requirements: Create a program called numstat.py that reads a series of integer numbers from a file and determines...

  • In Java Programming: Create a flow chart for a program that prompts for an integer N...

    In Java Programming: Create a flow chart for a program that prompts for an integer N (number of students) and M (number of test scores for each students), and allows the user to N*M real numbers. The program then calculates the average for each student and class average. (1) Prompt the user to input N students and M test scores, then display the inputs. Enter number of students: You entered: 2 Enter number of test scores: You entered: 3 Enter...

  • In c++ programming, can you please edit this program to meet these requirements: The program that...

    In c++ programming, can you please edit this program to meet these requirements: The program that needs editing: #include <iostream> #include <fstream> #include <iomanip> using namespace std; int cal_avg(char* filenumbers, int n){ int a = 0; int number[100]; ifstream filein(filenumbers); if (!filein) { cout << "Please enter a a correct file to read in the numbers from"; }    while (!filein.eof()) { filein >> number[a]; a++; } int total = number[0]; for (a = 0; a < n; a++) {...

  • Write a program in C++. You need everything everythihng given You will create a function that...

    Write a program in C++. You need everything everythihng given You will create a function that validates input. It should accept only non-negative integers. If the input is incorrect the function should throw an exception. The exception will not be caught in the function. You will create a function that reads in 2 integer values. One is a number that will be raised to the power of the second. So if 5 and 6 are entered the result would be...

  • This is a C program. please help me to write a pseudocode of the program ....

    This is a C program. please help me to write a pseudocode of the program . also, I want the program In a do...while loop and the screen output should look like in the picture. please help me. 3.1. Write a program that asks the user to continue to enter two numbers (at a time). For each pair of numbers entered, the program calculates the product of those two numbers, and then accumulate that product. For each pair of numbers...

  • Write a program that allows the user to enter a series of exam scores. The number...

    Write a program that allows the user to enter a series of exam scores. The number of scores the user can enter is not fixed; they can enter any number of scores they want. The exam scores can be either integers or floats. Then, once the user has entered all the scores they want, your program will calculate and print the average of those scores. After printing the average, the program should terminate. You need to use a while loop...

  • Question 7 (a) Write a C program that performs the following tasks: 1. Create a text...

    Question 7 (a) Write a C program that performs the following tasks: 1. Create a text file to store a list of numbers. 2. Read a number entered by a user and store it into the text file until a negative number is entered. (b) Write a C program that performs the following tasks: 1. Open the text file that contains a list of numbers. 2. Print the list of numbers stored in the text file on the screen.

  • I need to Write a test program that prompts the user to enter 10 double values...

    I need to Write a test program that prompts the user to enter 10 double values into an array, calls a method to calculate the average of the numbers, and displays the average. Next, write a method that returns the lowest value in the array and display the lowest number. The program should then prompt the user to enter 10 integer values into an array, calculates the average, and displays the average. The program should have two overloaded methods to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT