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
If person A creates an image with a creative common license. Person B then uses the image on his website. Who own the image and
Rudik [331]
Person A, of course. This person is the original maker of the image therefore that person has the rights to that image, person B does not automatically become the owner just by using it on his website. So the answer is person A.
3 0
2 years ago
Your program is going to compare the distinct salaries of two individuals for the last 5 years. If the salary for the two indivi
kirza4 [7]

In python:

i = 1

lst1 = ([])

lst2 = ([])

while i <= 5:

   person1 = int(input("Enter the salary individual 1 got in year {}".format(i)))

   person2 = int(input("Enter the salary individual 1 got in year {}".format(i)))

   lst1.append(person1)

   lst2.append(person2)

   i += 1

if sum(lst1) > sum(lst2):

   print("Individual 1 has the highest salary")

else:

   print("Individual 2 has the highest salary")

This works correctly if the two individuals do not end up with the same salary overall.

4 0
2 years ago
Anyone know how to fix this problem on Microsoft Team?
lesya [120]

Answer:

Wait for some time and reload the page

Fix the corrupted file

The file is deleted before finishing upload

Clear browser cache.

Explanation:

7 0
2 years ago
Read 2 more answers
True or false?
kenny6666 [7]

Answer:

True

Explanation:

An effective way of protecting programs against classic stack overflow attacks is to instrument the function entry and exit code to setup and then check its sack frame for any evidence of corruption.

5 0
3 years ago
Read 2 more answers
The average pH of citrus fruits is 2.2, and this value has been stored in the variable avg_citrus_pH . Provide a statement to di
olasank [31]

Answer:

The statement in Python is:

print("The average pH of citrus fruits is ",avg_citrus_pH)

Java

System.out.print("The average pH of citrus fruits is "+avg_citrus_pH);

C++

cout<<"The average pH of citrus fruits is "<<avg_citrus_pH;

Explanation:

The programming language is not stated; so, I answered the question in 3 languages (Python, Java and C++)

Assume that avg_citrus_pH has been declared and initialized; all you need to do is invoke a print statement and then append the variable

In Python, use print()

In c++, use cout<<

In Java, use System.out.print()

So, the statements are:

Python:

print("The average pH of citrus fruits is ",avg_citrus_pH)

Java

System.out.print("The average pH of citrus fruits is "+avg_citrus_pH);

C++

cout<<"The average pH of citrus fruits is "<<avg_citrus_pH;

8 0
2 years ago
Other questions:
  • In these weeks readings, we learned about the CIA Triad and how each exhibits dependence on the other. Give examples of how fail
    12·1 answer
  • Who is the founder of javascript? ​
    14·2 answers
  • Which of the following is true about radio waves? They have short wavelengths. They have high energies. They reveal hot gases. T
    10·2 answers
  • Write a for loop that runs 5 times and accepts the input of an integer number every time. Those numbers will be accumulated by a
    7·1 answer
  • Use the drop-down menus to complete the statements about changing mail options in Outlook.
    10·1 answer
  • Select the correct answer.
    10·1 answer
  • Role of memory in a computer system
    10·1 answer
  • Write a program that asks the user to enter a positive integer that represents a number in the decimal system and then displays
    12·1 answer
  • Bluetooth is the popular name for the 802. 15 wireless networking standard, which is useful for creating small __________.
    13·1 answer
  • How do I find unwanted programs on my computer?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!