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
Marrrta [24]
3 years ago
9

Complete the program below that takes in one positive, odd, integer, n (at least 3), and prints a "diamond" shape of stars with

the widest part of the diamond consisting of n stars. For example, if the input is n=5, the output would be:
*
***
*****
***
*
If the input is n=9, the output would be:
*
***
*****
*******
*********
*******
*****
***
*
The diamond shape has rows of stars (asterisks) with and odd number of stars on each row. In the n=9 example, the rows had 1 star, 3 stars, 5 stars, 7 stars, 9 stars, 7 stars, 5 stars, 3 stars, and 1 star. Additionally, the rows with less than n stars have leading spaces to "center" the row (so that the center star of each row is directly above/below the center star of the other rows). Spaces are important in this assignment. Assume there are no trailing spaces (spaces at the end of each row). Because n must be odd and each row will have an odd number of stars, every row will have a "center" star.
Computers and Technology
1 answer:
avanturin [10]3 years ago
5 0

Answer:

n = int(input("Enter the n (positive odd integer): "))

for i in range(1, n+1, 2):

   print(i*"*")

for i in range(n-2, 0, -2):

   print(i*"*")

Explanation:

*The code is in Python.

Ask the user to enter the n

Create a for loop that iterates from 1 to n, incrementing by 2 in each iteration. Print the corresponding number of asterisks in each iteration

Create another for loop that iterates from n-2 to 1, decrementing by 2 in each iteration. Print the corresponding number of asterisks in each iteration

You might be interested in
What is the usual price of smartphone apps?
natka813 [3]

0-20 dollars

that's the usual cost for apps

and for phone it's cost

RS 32,000 Nepali rupes

you can convert it by dividing it by 110

and you will get price in dollars

8 0
3 years ago
Read 2 more answers
Which TranscribeMe tag should you use if you are unable to make out a word or phrase due to a difficult accent, poor audio, or a
Lady bird [3.3K]

Answer:

[inaudible]

Explanation:

TranscribeMe is an online transcription company. It employs people all over the world to render transcription services to clients. They have a style guideline which must be strictly adhered to by the transcribers. The guidelines specifically states the "do's " and "dont's" during transcription. Now, when transcribing a word or phrase that cannot be heard or understood due to poor audio or difficult answer, the transcriber uses the tag [inaudible].

5 0
3 years ago
Which of the following is true about advertisements?
katrin [286]

the answer is they often contain biases :)

3 0
2 years ago
When saving a memo you created in Word, which of the following extensions is automatically assigned to the document?
Lena [83]
.docx is the default file extension on a Word doc.
6 0
3 years ago
Read 2 more answers
What class of attacks use innovative attack tools and once a system is infected it silently extracts data over an extended perio
KatRina [158]

Answer:

Advanced persistent threat.

Explanation:

Advanced persistent threat is a threat actor implemented by either a government supported or private group to intrude a network or system and stays undetected, collecting information over a period of time.

It is used by cyber terrorist group to facilitate massive attacks based on the information retrieved. National or government group use the concept to promote national security.

7 0
3 years ago
Other questions:
  • What is the 7 X 7 when referring to PowerPoint presentations?
    12·2 answers
  • Helping people keep track on things is the purpose of_____ A database B table C query D form​
    12·1 answer
  • What is the output of the following code? public class Test { public static void main(String[] args) { String s1 = new String("J
    9·1 answer
  • What is an activity that can help you enhance the appearance of your computer’s desktop?
    13·1 answer
  • 27. If X and Y are int type variables,
    14·1 answer
  • Coral Given three floating-point numbers x, y, and z, output x to the power of y, x to the power of (y to the power of z), the a
    6·1 answer
  • If I got a monitor and kept my garbage laptop could I play games on max graphics?
    13·1 answer
  • What will be the output of the following code?
    14·1 answer
  • A school has an intranet for the staff and students to use. Some of the files stored on the intranet are confidential. Give two
    15·1 answer
  • Post back maintains view state by assigning the form values to a hidden form field named ____.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!