Question: Write a python program for the following prompt. Write a graphics method: makeStripe (n, ch) that returns n consecutive ch characters, (e.g., makes tripe (5,
Write a python program for the following prompt.
Write a "graphics" method: makeStripe (n, ch) that returns n consecutive ch characters, (e.g., makes tripe (5, ' X') should return XXXXX) Use this method to write a program that draws triangles. For example, you can use these methods to draw one of these patterns: Try and draw your triangles efficiently (i.e., using loops to minimize the number of statements). Handle choices outside 1 to 5; after printing the result, clear out the result string. If the number entered for the size of base is even, use the next higher odd number. Here is the precise dialog required: Program to draw triangles. Written by John Koch. Please choose an option: 1, for triangle pointing up; 2, for triangle pointing down; 3, to print the result; 4, to add a blank line; 5/to stop this program; Enter size of base: 11 Enter character used to draw: * Enter number of blanks preceding each line: 0 Please choose an option: 1, for triangle pointing up; 2, for triangle pointing down; 3, to print the result; 4, to add a blank line; 5, to stop this program; Enter size of base: 11 Enter character used to draw: * Enter number of blanks preceding each line: 0 Please choose an option: 1, for triangle pointing up; 2, for triangle pointing down; 3, to print the result; 4, to add a blank line; 5, to stop this program; Enter size of base: 3 Enter character used to draw: * Enter number of blanks preceding each line: 3 The program should be stored in triangles.py. You may run turnin for triangles as many times as you want. This program is due at noon on Tuesday, April 18, 2017. This program is worth 90 points. Write a "graphics" method: makeStripe (n, ch) that returns n consecutive ch characters, (e.g., makes tripe (5, ' X') should return XXXXX) Use this method to write a program that draws triangles. For example, you can use these methods to draw one of these patterns: Try and draw your triangles efficiently (i.e., using loops to minimize the number of statements). Handle choices outside 1 to 5; after printing the result, clear out the result string. If the number entered for the size of base is even, use the next higher odd number. Here is the precise dialog required: Program to draw triangles. Written by John Koch. Please choose an option: 1, for triangle pointing up; 2, for triangle pointing down; 3, to print the result; 4, to add a blank line; 5/to stop this program; Enter size of base: 11 Enter character used to draw: * Enter number of blanks preceding each line: 0 Please choose an option: 1, for triangle pointing up; 2, for triangle pointing down; 3, to print the result; 4, to add a blank line; 5, to stop this program; Enter size of base: 11 Enter character used to draw: * Enter number of blanks preceding each line: 0 Please choose an option: 1, for triangle pointing up; 2, for triangle pointing down; 3, to print the result; 4, to add a blank line; 5, to stop this program; Enter size of base: 3 Enter character used to draw: * Enter number of blanks preceding each line: 3 The program should be stored in triangles.py. You may run turnin for triangles as many times as you want. This program is due at noon on Tuesday, April 18, 2017. This program is worth 90 points
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
