Question: Using python program Write a program that draws a right triangle (a triangle with equal width and height). Your program should prompt the user for
Using python program Write a program that
draws a
right triangle (a triangle with equal width and height).
Your program should prompt the user for the height of the triangle,
and the symbol it should be made of.
For these inputs, you can assume the following:
The height will be a positive integer
(zero or greater)
The symbol will be a single
character
You should then use the symbol they chose to print a right triangle of the
height they indicated.
HINT:
You can keep the
print()
function from printing on a new line by
using
end="
"
at the end:
print(
"Hello"
, end=
"
"
)
. If you do want to
print a new line, you can call print without an argument:
print()
.
Here is some sample output, with the user input in blue.
bash
-
4.1$ python hw3_part7.py
Please ente
r the height of your triangle:
3
Please enter a single character for the symbol:
$
$
$$
$$$
bash
-
4.1$ python hw3_part7.py
Please enter the height of your triangle:
0
Please enter a single character for the symbol:
g
bash
-
4.1$ python hw3_part7.py
Please enter the height
of your triangle:
7
Please enter a single character for the symbol:
W
W
WW
WWW
WWWW
WWWWW
WWWWWW
WWWWWWW
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
