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
Which of the following best describes a toolbar?
nataly862011 [7]
Easy fast access to common apps or programs

3 0
3 years ago
The Chart below from Google Trends shows the prevelance of some search terms in the United States between 2004 and the present.
ad-work [718]

The question is incomplete. The complete question could be found here: https://www.coursehero.com/file/p655c1i/a-Maintaining-privacy-of-the-information-stored-in-the-data-set-b-Scalability/

Answer:

B. Generally speaking, since 2009 more people use "red" in their search terms more than they use "blue", "yellow", "green", or "purple."

Explanation:

Based on the data provided in the figure, it can be inferred that the color 'red' was used the most in the search terms compared with the other colors such as purple or green. The other colors were also used in the search terms on google, however, the trend of those that used the color 'red' in the search terms is the highest.

8 0
3 years ago
What are the steps to open the Custom AutoFilter dialog box?
uranmaximum [27]

Answer:

data, sort and filter, text filters

Explanation:

ed 2020

7 0
3 years ago
Read 2 more answers
Hello 10 points if my Chromebook is on 26 percent how much time do I have left theoretically
velikii [3]
About 15 minutes.......
7 0
3 years ago
Read 2 more answers
Describe at least one issue of terrorism that has happened recently.
zvonat [6]

Answer:

The republicans storming the capitol

Explanation:

6 0
3 years ago
Other questions:
  • Marie uses a browser to visit a blog. What is the unique identifier of the blog?
    5·1 answer
  • \What will the weather most likely be like the day after a warm front? (4 points) The temperature will be cool or cold, and ther
    7·2 answers
  • A network administrator notices that some newly installed Ethernet cabling is carrying corrupt and distorted data signals. The n
    8·1 answer
  • A company purchased a high-quality color laser printer to print color brochures and sales proposals. The printer is connected to
    5·1 answer
  • Sean Cody is a website most known for what?
    9·2 answers
  • What is data analysing data and give three examples ?​
    9·1 answer
  • A blogger writes that the new "U-Phone" is superior to any other on the market. Before buying the U-Phone based on this review,
    7·2 answers
  • What is one way to process your thoughts about the information you are reading?
    15·1 answer
  • Define a query that uses the Natural Join command to join three tables to produce useful information.
    14·1 answer
  • Please help me asapppp!​
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!