1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ray Of Light [21]
3 years ago
15

Python 3.12 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: # ******## ******### ******## #
Computers and Technology
1 answer:
Sloan [31]3 years ago
3 0

The code below prints the required shape using the string manipulations in Python.

In Python, if we multiply a character with a number, we get that character side by side that number of times.

For example: 6 * '#' would give us → ######

Also, we can use + sign to concatenate the strings.

For example: 'hi' + ' there' would give us → hi there

We use this approaches to print the required shape line by line.

Comments are used to explain each line.

The output is attached as an image.

#get the characters from the user

base_char = input()

head_char = input()

#set first row with 6 spaces and 1 head_char

row1 = 6 * ' ' + head_char

#set second row with 6 base_chars and 2 head_chars

row2 = 6 * base_char + 2 * head_char

#set third row with row2 and 1 head_char

row3 = row2 + head_char

#print the rows to draw the shape

print(row1)

print(row2)

print(row3)

print(row2)

print(row1)

You may see another question at:

brainly.com/question/22101725

You might be interested in
What is bespoke software???​
denis-greek [22]

Answer:

custom-built to address the specific requirements of a business

Explanation:

5 0
3 years ago
Read 2 more answers
What is ur favorite color and why
inysia [295]

Answer:

Sky blueeeee!!

Explanation:

It's the color of my eyes. And I just like it ^^

6 0
3 years ago
Read 2 more answers
3. with a dui charge on a driver’s record ______________. a. the price of his or her insurance greatly increases b. he or she ma
djyliett [7]
<span>The answer to your question is D. both A and C</span>
7 0
4 years ago
Identifying Characters
alina1380 [7]
The answer is d I just took the test
5 0
3 years ago
Read 2 more answers
Câu 4. Trong môi trường lập trình CodeBlocks phím F9 dùng để: A. Biên dịch chương trình B. Chạy chương trình C. Soạn thảo chương
Debora [2.8K]

Answer:

câu trả lời là c nha

Explanation:

7 0
3 years ago
Other questions:
  • An app for a hair styling stop needs a form for the various services that they offer. What control should be used to display all
    6·1 answer
  • Write code that inserts useritems into the output string stream itemsoss until the user enters "exit". each item should be follo
    15·1 answer
  • Function templates ___________.
    5·1 answer
  • Why would it be a bad idea for gateways to pass broadcast packets between networks? What would be the advantages of doing so
    12·1 answer
  • A user prefers an external monitor, mouse, and keyboard for a laptop. The user does not want to use the built-in screen; however
    5·1 answer
  • What are the examples of personal computers ?
    8·1 answer
  • What is the advantage of using a translation look-aside buffer (TLB), also called associative memory, in the logical-physical ad
    15·1 answer
  • Look at (d), is it accurate? ​
    9·2 answers
  • 3. Compilers and Assemblers translate each source file individually to generate object code files. Hence the object files need t
    13·1 answer
  • Indentation is useful to make the document easier to read. To increase the indentation of the paragraph, you press the increase
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!