banner



4.11 Program: Drawing A Half Arrow (Java)

  1. Home
  2. »
  3. Questions
  4. »
  5. Computer Science
  6. »
  7. Programming Languages
  8. »
  9. Programming Languages - Others
  10. »
  11. PYTHON This program outputs a downwards facing...

PYTHON This program outputs a downwards facing arrow composed of a rectangle and a right triangle... 1 answer below »

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)

while arrow_head_width <= arrow_base_width: print ('Enter arrow head width: ') arrow_head_width = int(input())

Example output for arrow_base_height = 5, arrow_base_width = 2, and arrow_head_width = 4:

Enter arrow base height: 5 Enter arrow base width: 2 Enter arrow head width: 4 ** ** ** ** ** **** *** ** *

the code they start me with is as follows: *Untitled File Edit Format Run Options Window Help print Enter arrow base height arrow base height int (input print (Enter arrow base width: arrow base width int (input 0) print (Enter arrow head width arrow head width int (input Draw arrow base (height F 3, width F 2) convert these repetitive lines to a loop print 2) print 2) print 2) Draw arrow head (viidth convert these repetitive lines to a loop width 4 print width) width print width) width print width) width print width)

*Untitled File Edit Format Run Options Window Help print "Enter arrow base height arrow base height int (input print ('Enter arrow base width: arrow base width int (input 0) print ('Enter arrow head width arrow head width int (input Draw arrow base (height F 3, width F 2) convert these repetitive lines to a loop print 2) print 2) print 2) Draw arrow head (viidth convert these repetitive lines to a loop width 4 print width) width print width) width print width) width print width)

4.11 Program: Drawing A Half Arrow (Java)

Source: https://www.transtutors.com/questions/python-this-program-outputs-a-downwards-facing-arrow-composed-of-a-rectangle-and-a-r-2757647.htm

Posted by: mentzerdriers.blogspot.com

0 Response to "4.11 Program: Drawing A Half Arrow (Java)"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel