25.5k views
2 votes
python This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width. (1) Modify the given program to use a loop to output an arrow base of height arrow_base_height. (1 pt) (2) Modify the given program to use a loop to output an arrow base of width arrow_base_width. (1 pt) (3) Modify the given program to use a loop to output an arrow head of width arrow_head_width. (2 pts) (4) Modify the given program to only accept an arrow head width that is larger than the arrow base width. Use a loop to continue prompting the user for an arrow head width until the value is larger than the arrow base width. (1 pt)

User Fematich
by
3.6k points

2 Answers

7 votes

Answer:

See explaination for code

Step-by-step explanation:

arrow_base_height = int(input('Enter arrow base height:\\'))

arrow_base_width = int(input('Enter arrow base width:\\'))

arrow_head_width = arrow_base_width

while arrow_head_width <= arrow_base_width:

arrow_head_width = int(input('Enter arrow head width:\\'))

print()

for i in range(arrow_base_height):

for j in range(arrow_base_width):

print('*', end='')

print()

for i in range(arrow_head_width):

for j in range(arrow_head_width-i):

print('*', end='')

print()

User Gaket
by
4.0k points
6 votes

Answer:

Check the explanation

Step-by-step explanation:

arrow_base_height = int(input('Enter arrow base height:\\'))

arrow_base_width = int(input('Enter arrow base width:\\'))

arrow_head_width = arrow_base_width

while arrow_head_width <= arrow_base_width:

arrow_head_width = int(input('Enter arrow head width:\\'))

print()

for i in range(arrow_base_height):

for j in range(arrow_base_width):

print('*', end='')

print()

for i in range(arrow_head_width):

for j in range(arrow_head_width-i):

print('*', end='')

print()

Kindly check the code output below.

python This program outputs a downwards facing arrow composed of a rectangle and a-example-1
User Slackline
by
3.2k points