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
Use a while loop to output the even number from 100 to 147? This is python
KiRa [710]

Answer:

def main():

 i = 100

 while(i < 148):

   print(i)

   i += 2

main()

Explanation:

7 0
2 years ago
c++ Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value is c
Ksivusya [100]

<u>Answer:</u>

<em>int fNumber,scndNumber = -1,  </em>

<em>dup = 0; </em>

<em>do { </em>

<em>cin >> fNumber; </em>

<em>if ( scndNumber == -1) { </em>

<em>scndNumber = fNumber; </em>

<em>} </em>

<em>else { </em>

<em>if ( scndNumber == fNumber ) </em>

<em>duplicates++; </em>

<em>else </em>

<em>scndNumber = fNumber; </em>

<em>} </em>

<em>} while(fNumber > 0 );  </em>

<em>cout << dup; </em>

<u>Explanation:</u>

Here three variables are declared to hold the first number which is used obtain all the inputs given by the user, second number to hold the value of <em>last encountered number and “dup” variable to count the number of duplicate values.</em>

<em>“Do-while”</em> loop help us to get the input check whether it is same as previous input if yes then it <em>adds to the duplicate</em> value otherwise the new previous value if stored.

4 0
3 years ago
Read 2 more answers
Si han visto el anime death note esta chido si no lo han visto veanlo es bien vacano
geniusboy [140]

Odio el anime que lloras

3 0
3 years ago
Explain why microcomputers are installed with TCP/IP protocols?​
Kay [80]

Answer:

microcomputers are installed with TCP/IP protocols because its a set of standardized rule that allows the computer to communicate on a network such as the internet

7 0
3 years ago
For which of the four game elements will you give a detailed description about the challenges that the player will face, such as
vaieri [72.5K]

The four game elements that will give you  a detailed description about the challenges that the player will face is option D: objective.

<h3>What goals does game development have?</h3>

To bring about creativity and originality in task completion and issue solving. to prepare pupils for group collaboration.

Note that giving the player a clear objective gives them something to aim for. Make sure the player can relate to this motivation.

Therefore, The most crucial component of a game can be its objectives, which determine how the game is won or lost, what the player is instructed to perform in-game, and what the player must do to gain optional <em>Achievements</em>.

Learn more about objective from

brainly.com/question/18516671
#SPJ1

3 0
1 year ago
Other questions:
  • If you quote an author from a website in a paper, it will be important to create a _____ in your writing to give them credit for
    7·2 answers
  • Which protocol would you utilize to upload files to a web server?
    14·1 answer
  • Find the simple interest Jay owes on a five-year student loan of $48,000 with an annual interest rate of 5%.
    9·1 answer
  • Your smartphone, digital camera, and printer are all part of a network in your workspace. What type of network is likely in use
    7·1 answer
  • Write a program named SortWords that includes a method named SortAndDisplayWords that accepts any number of words, sorts them in
    10·1 answer
  • How do i beat the final battle in lara croft: temple of osiris?
    9·1 answer
  • Mrs. Sims polled her students about which social media app they use most. Which type of chart would best display this data?
    9·1 answer
  • What percentage of teens say they have witnessed cyberbullying?
    6·2 answers
  • Complete the sentence.
    10·1 answer
  • Computers were originally developed to accomplish various tasks in relative isolation, very different from the collaboration and
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!