Determine the average of some integers

Assignment Help Basic Computer Science
Reference no: EM131268727

Plan each program by writing pseudocode.

Write all lines of your pseudocode as comments immediately.

Add more comments in each program to explain what your code is doing.

Choose descriptive variable names in all programs.

1. Write a program called program41.py that uses a for loop and the range functionto output the numbers from 5 up to 100 by fives exactly as shown (all numbers all on the same line, separated by a single space). Output "That's that!" (note apostrophe) on a new line to end the program as shown below.

SAMPLE RUN
5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100
That's that!

2. Write another program called program42.py that generates exactly the same output as the program above, but by using a while loop.

3. Write a program named program43.py that uses nested loops to generate a triangle as shown in the sample run. The program should begin by prompting the user to enter the number of lines in the triangle.

4. Write a program named program44.py that can be used to determine the average of some integers. The number of integers can vary, and this should not be initially set by user input (see sample output). Instead, use a while loop and a sentinel value of zero to cease integer input. Display the average accurate to two decimal places.

SAMPLE RUN

Enter integer 12

Enter integer 9

Enter integer 8

Enter integer 14

Enter integer 0

The average is 10.75

Reference no: EM131268727

Questions Cloud

Method that returns the number of consonants : Write a class with a constructor that accepts a String object as its argument. The class should have a method that returns the number of vowels in the string, and another method that returns the number of consonants in the string. Demonstrate the ..
Input two arrays of information : Write a program that will input two arrays of information. Each array will contain exactly 4floating point values. Your program will enter these values from standard input.
Malloc up space for a one-dimensional array of n integers : Write a program that will first read in a positive integer number, say n, from standard input. Then you need to create enough space in the heap via a call to malloc to hold an array of n integers.You then need to use array index operators to fill ..
How fast is its daily cost for hamburgers increasing : If the restaurant s daily sales are increasing at the rate of 30 hamburgers per day, how fast is its daily cost for hamburgers increasing?
Determine the average of some integers : Write a program named program43.py that uses nested loops to generate a triangle as shown in the sample run. The program should begin by prompting the user to enter the number of lines in the triangle.
How fast is its daily cost for hamburgers increasing : If the restaurant s daily sales are increasing at the rate of 30 hamburgers per day, how fast is its daily cost for hamburgers increasing?
What requirements must a public-key cryptosystems : 1. What requirements must a public-key cryptosystems fulfill to be a secure algorithm? 2. In the SHA-512 hash function,
Evaluate the volatility risks in the fund : Evaluate the volatility risks in the fund, providing an assessment of the fund manager's performance based on the risk measurements for the fund. Make a recommendation to the fund manager for improving the performance.
Information security standard or compliance law : As a group, decide on an Information Security Standard or Compliance Law that is applicable to your hypothetical Fortune 500 company. Explain to your CTO what the rule/law is and what your organization needs to do to ensure compliance.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  What security concerns might arise over mobile access

What security concerns might arise over mobile access to private corporate information

  How procuring organization has sorted out problem

You are the engineer involved in development of financial system. Should you simply abandon work until procuring organization has sorted out problem?

  Managing information technology projects

1.Describe how organizational culture is related to project management. what type of cultures promote a strong project? 3. Explain the four frames of organizations. how can they help project manager understand the organizational context for their pro..

  Create a system using dasylab which produces the fourier

Create a system using DASYLab which gives you the sum of the first n sinusoidal signals (n = 1,2,3,....9) as in Illustration 27

  Computing days take for fine to reach d dollars

In the recent court case, a judge cited the city for contempt and ordered fine of $2 for first day. Each subsequent day, till the city followed judge's order, fine was squared.

  Overload the operator >> and the operator << for a class

Self-test exercise 17 asked you to overload the operator >> and the operator

  Explain what is meant by the term foreign key

Explain what is meant by the term foreign key.Explain what is meant by the term foreign key.

  Use eulers method

Use Euler's Method with (a) h=.5, (b) h=.25, and (c) h=.05 to solve dy/dx=yx^3-2.3y over the interval from x=0 to 2, where y(0)=1.

  How to motivate your employees

Describe also how to motivate your employees to accept the change and positively contribute to it and show its advantages and disadvantages. Characterise differences between the regions when appropriate.

  Find a function giving the volume of the resulting box

find a function giving the volume of the resulting box.

  Find the opportunity cost of producing

a) Find the opportunity cost of producing each unit of food in terms of clothing. Explain its pattern. b) Assume we are currently producing 6 units of clothing and 4 units of food. Plot this point and interpret it economically.

  Expect the p-values to have a uniform distribution

If the signal strengths are roughly normal, then we expect the p-values to have a uniform distribution. This leads to about 5% of the p-values for the 8000 tests to fall below 0.05.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd