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

  Determine what believe the top-five challenges integrating

Autonomous vehicles utilize integrated imaging and vision systems, sensor systems, and control systems to "drive a car". Determine what you believe are the top-five challenges of integrating these systems

  How frequently should costs be updated

Consider a situation in which several tasks may be for one to two years rather than the 200 hours normally used in the work-package level of the WBS.

  Experiment with computer system measurements

Platform. Pick a Unix-based platform to work on. This might very likely be something like a PC running Linux, but feel free to experiment with whatever system you have access to, e.g., FreeBSD, some old UNIX system like AIX, or even Mac OS X.

  Moral obligation to promote the greater good

Christian servant leaders profess to serve those whom they lead through love and the moral obligation to promote the greater good of others.

  Why would the receiver need an extra timer

Why would the receiver need an extra timer if it were responsible for reporting that its advertised window had become nonzero (i.e., if the sender did not probe)?

  Use the supplied superclass car to create classes

Because Toyotas are superior to Fords or Chevys it should also implement the supplied Airplane interface. Give the methods something to do. I would suggest a println method since you can then see that the method actually ran.

  Prevention scheme with wait-wound scheme

Compare wait-die deadlock prevention scheme with wait-wound scheme.

  Number of multiplications used by the fast exponentiation

Give a precise count on the number of multiplications used by the fast exponentiation routine. (Hint: Consider the binary representation of N.)

  Disaster recovery or business continuity

The following summary must be at least 300 words and list the URL for the article you summarize. Find an online article regarding Disaster Recovery OR Business Continuity.

  Advantages and disadvantages of software suites

List out the virtual company strategies.What are the differences between direct and sequential access in storage divices? Software Suites bundle together a variety of general-purpose software applications. Using your words, explain the advantages ..

  Explain activities of business modeling discipline

Activities of business modeling discipline study the information needs of user, the ways in which those requirements are being.

  Which of these six vectors are the support vectors

Starting with your answer to part (b), use gradient descent to find the optimum w and b. Note that if you start with a separating hyper plane, and you scale w properly, then the second term of Equation 12.4 will always be 0, which simplifies your ..

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