Nested loops to generate a triangle

Assignment Help Python Programming
Reference no: EM131268732

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

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: EM131268732

Questions Cloud

How fast is the top of the ladder rising : If the foot of the ladder is pushed toward the wall at 0.5 foot per second, how fast is the top of the ladder rising when the foot is 8 feet from the wall?
What a sustainable system means : Describe in your own words how the interaction of these three themes would result in a sustainable system, as well as what a sustainable system means.
What effects has oprah''s charisma had on her followers : What effects has Oprah's charisma had on her followers?
Write a single statement that assigns the values : Write a single statement that assigns the values 99, 100 and 88 to an integer array named TestScores. Use the C++ notation used for the "lotterynumbers" array.
Nested loops to generate a triangle : Write a program called program41.py that uses a for loop and the range functionto output the numbers from 5 up to 100 - Write another program called program42.py that generates exactly the same output
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?

Reviews

Write a Review

Python Programming Questions & Answers

  The program should allow the student

The program should allow the student to enter the answer. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed.

  Program that allows the user to enter the type of coin

Create a program that allows the user to enter the type of coin to be evaluated and the number of coins. The program should calculate the total weight of the coins and the height of the coins when stacked. Name the program coins.py. Use the table bel..

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

  Programmer does not have to use the def statement

Unlike Z+-, the programmer does not have to use the DEF statement to create a variable. Instead, the programmer can simply use the variable. The first use of the variable creates it and initializes it to 0.

  Implement a program in python that given names of students

Implement a program in Python that, given 500 names of students and 500 integers in the range (0,100) representing the scores of these 500 students, calculates

  Assignment work in python

Write a function interleave two pictures take the first 20 pixels from the first picture and then 20 pixels from the second picture and then the next 20 pixels from the first picture and then the next 20 pixels from the second picture and so on till ..

  Find the number of vowels in the string

Using list and one definition for find the Number of vowels in the String.

  Python project description

Grep all required data listed from the 1) to 7) and construct required run file for each step (pnr, drc, lvs, syn, pwr)based upon the choice of technology and process when executing your script.

  Write a program that asks for the users age

Write a program that asks for the user's age. Based on their response print "You can vote" (18 years old or older) or "You can't vote" and also whether or not he/she is a senior citizen (over 64). If senior citizen print "You're a Senior Citizen.

  Calculate the total displacement of the system of springs

Calculate the total displacement of the system of springs - You are free to use any linear system solver from chapter 6, including the solvers that are part of the SciPy and/or numpy packages.

  Create a ride share simulator assignment

Create a ride share simulator assignment. In this particular function, I am trying to create a list of the drivers in a Driver Class that are currently listed as idle. Since they are idle, I can then match them up with an awaiting rider. The assignme..

  How many cents for each paper

Using Tkinter for cents Program, find the How many cents for each Paper

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