4.15 LAB: Input and formatted output: Right-facing arrow Given input characters for an arrowhead and arrow body, print a right-facing arrow. Ex: If the input is: Then the output is: LAB 4.15.1: LAB: Input and formatted output: Right-facing arrow 0/10 ACTIVITY main.py Load default template. 1 base_char = input() 2 head char = input() 3 4 rowl = + head_char 5 ** Type your code here. 6 7 print(row1) 8 print(row2) 9 print(row3) 10 print(row2) 11 print(row1) 12 13

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please here is a screenshot of my python Lab inputting an arrow

**4.15 LAB: Input and Formatted Output: Right-facing Arrow**

**Objective:**
Given input characters for an arrowhead and arrow body, print a right-facing arrow.

**Example:**
If the input is:

```
*
#
```

Then the output is:

```
    #
#****#
#****#
#****#
    #
```

**Code Explanation:**

Below is the Python code to generate the right-facing arrow based on user inputs:

```python
base_char = input()
head_char = input()

row1 = '    ' + head_char
row2 = base_char + head_char * 4 + base_char
row3 = base_char * 5 + head_char

print(row1)
print(row2)
print(row3)
print(row2)
print(row1)
```

**Instructions:**
1. The user is prompted to input two characters:
   - `base_char`: used for the body of the arrow.
   - `head_char`: used for the head of the arrow.

2. The program constructs and prints each row of the arrow:
   - `row1` is a single `head_char` with spaces preceding it to form the arrowhead.
   - `row2` is constructed with one `base_char`, followed by four `head_char` and another `base_char`.
   - `row3` is made of five `base_char` and a `head_char`.

3. The arrow is printed by displaying `row1`, `row2`, `row3`, then `row2` and `row1` again in sequence to complete the shape.
Transcribed Image Text:**4.15 LAB: Input and Formatted Output: Right-facing Arrow** **Objective:** Given input characters for an arrowhead and arrow body, print a right-facing arrow. **Example:** If the input is: ``` * # ``` Then the output is: ``` # #****# #****# #****# # ``` **Code Explanation:** Below is the Python code to generate the right-facing arrow based on user inputs: ```python base_char = input() head_char = input() row1 = ' ' + head_char row2 = base_char + head_char * 4 + base_char row3 = base_char * 5 + head_char print(row1) print(row2) print(row3) print(row2) print(row1) ``` **Instructions:** 1. The user is prompted to input two characters: - `base_char`: used for the body of the arrow. - `head_char`: used for the head of the arrow. 2. The program constructs and prints each row of the arrow: - `row1` is a single `head_char` with spaces preceding it to form the arrowhead. - `row2` is constructed with one `base_char`, followed by four `head_char` and another `base_char`. - `row3` is made of five `base_char` and a `head_char`. 3. The arrow is printed by displaying `row1`, `row2`, `row3`, then `row2` and `row1` again in sequence to complete the shape.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education