![ravenl1001](/avatars/39100.jpg)
ravenl1001
26.02.2020 •
Computers and Technology
Write a program that prompts users to enter: A character to use (any character besides *) The width of the display The height of the display to produce an E shape. The middle horizontal line must print at line height/2. This is an example for width of 10 and height of 9 * * *
Solved
Show answers
More tips
- S Society and Politics What If There s War Tomorrow, What If We Go to War?...
- S Sport How to Do a Jumping Split...
- A Animals and plants What Do Terriers Eat?...
- F Food and Cooking Discover the Benefits and Properties of Dates...
- C Computers and Internet Dynamically Assigned IP Address: What Is It and How Does It Work?...
- S Style and Beauty How to Get Rid of Acne: Scientifically Proven Methods...
- H Health and Medicine Simple Ways to Lower Cholesterol in the Blood: Tips and Tricks...
- O Other How to Choose the Best Answer to Your Question on The Grand Question ?...
- L Leisure and Entertainment History of International Women s Day: When Did the Celebration of March 8th Begin?...
- S Style and Beauty Intimate Haircut: The Reasons, Popularity, and Risks...
Answers on questions: Computers and Technology
- C Computers and Technology Choose a simple way to let a vpn into your vpc continue to work in spite of routing changes....
- M Mathematics IF ABC =8 , BC=12, AC =12 , and DE=16 what is the perimeter for triangle DEF...
- M Mathematics 2. Type the number that matches the words: Two billion, forty-five million, nine thousand, seven hundred....
- H History HELP!! I already got one question wrong which I can’t afford with strict parents...
- M Mathematics The formula A=πr^2 can be used to find the area of a circle. Solve the equation for r....
- M Mathematics If (72)x = 1, what is the value of x?...
- M Mathematics The probloms in the picture ^^^^...
- M Mathematics HELPPPPPPPPPPP .............
- S Social Studies What continent is at 20N and 20E...
- H History The temples on top of the were and centers....
Ответ:
The solution code is written in Python 3:
input_char = input("Enter a character (except *): ") width = int(input("Enter a width: ")) height = int(input("Enter a height: ")) checkpoints = [0, height//2 - 1, height-1] for i in range (height): if i not in checkpoints: print(input_char) else: output = "" for j in range(width): output += input_char print(output)Explanation:
Firstly, we use input function to prompt use to input a character, width and height (Line 1 -3)
Next we create a checkpoints list to define the line number where the input character should be printed following the width number of times (Line 5).
Next we can create a for-loop to traverse through the number from 0 till height (exclusive of height itself) (Line 7)
If the current i is not found in the checkpoints list, the print function will only display one input character. Else it will print the input character for width number of times(Line 9 -14).
This will eventually result in an E shape.
Ответ:
FALSE is the answer for ur question