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 the source rate r

Suppose that 30 pictures are sent per second. (This digital source is roughly equivalent to broadcast TV standards that have been adopted.) Determine the source rate R (bps).

  International mergers and joint ventures of firms

What are some of the major reasons for the rapid expansion in international mergers and joint ventures of firms?

  The user to enter the amount of a purchase.

Design a modular program that will ask the user to enter the amount of a purchase.

  Supporting activity-social media presence

Supporting Activity: Social Media Presence Research and find examples of how your organization (past, present or one you want to join) achieves its social media presence, and describe how the organization is using social media

  Few techniques to incorporate to site

Did you know that you do not have to start from scratch if your site is not accessible? There are a few techniques you may incorporate to your site.

  Describe how to use d

Suppose you have two nonempty stacks S and T and a deque D. Describe how to use D so that S stores all the elements of T below all of its original elements, with both sets of elements still in their original order.

  Describe operational risks and their sources

why cyber security exists and how it benefits the society, describe operational risks and their sources.describe product liability and the role of the government in acquisition and procurement of cyber security products and services.

  Practices for access control methods

What are some of industry's best practices for access control methods? What are some common access control models and the differences between each?

  Defend role of it department strategic and operational

Defend the role of the IT department as both a strategic and operational asset for the company.

  Datagrid control data source

What are the ways in which the functionalities can be added to DataGrid control data source?

  What should be the best course of action

What should be the best course of action if many quality issues arise? How can you deal with a situation when the work products are found to have more than an expected number of defects?

  System architecture before the requirements specification

When describing a system, explain why you may have to design the system architecture before the requirements specification is complete.

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