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
A common use-case for dictionaries is to store word counts. Let's modify our program below to store the count for each unique wo
baherus [9]

Answer:

word_count={}

for i in text.split:

        if i in word_count:

                word_count[i]+=1

         else:

                 word_count[i]=1

print word_count

8 0
3 years ago
Can someone please help???
Ksivusya [100]

Answer:

Look it up

Explanation:

You don’t need to buy another

8 0
2 years ago
Write a program code to accept the names of 3 users and generate a user name as shown in the example. Accept the name of 3 user
Nikitich [7]

Answer:

Explanation:

The following code is written in Python and is a function that loops three times asking for the last name and first name. Then it uses this information to create a username. Finally, each of the names and usernames is printed on the screen.

def userName():

   for x in range(3):

       last_name = input("What is your last name: ")

       first_name = input("What is your first name: ")

       username = first_name[:3] + "#" + last_name[-3:]

       print(last_name + ", " + first_name)

       print(username)

7 0
2 years ago
A customer is looking to replace three aging network servers that are not able to keep up with the growing demand of the company
weeeeeb [17]

Answer:

c. Type 1 hypervisor installed directly on server hardware.

Explanation:

The customer plans to replace the old network services to ensure that the operation and service of the company is fast and up-to-date. The old servers will slow down the activities of the company and can also affect the overall company's output. The best option is to use and type 1 hypervisor and it should be installed on the server hardware directly.

6 0
3 years ago
Select the best ansiver for each question below
Ratling [72]

Answer:

the answer is going to be system

7 0
3 years ago
Other questions:
  • According to the family life course development framework, the __________ stage of the family life cycle comes to an end with th
    7·1 answer
  • An essential skill today is knowing how to cite sources properly. Creative Commons has a system of licenses and tools for creato
    11·1 answer
  • _____ can be either software-based or deployed via hardware, such as a recording "dongle" that is plugged in between a keyboard
    8·1 answer
  • 6. Which of the following is malware? (1 point)
    15·2 answers
  • A. True
    8·1 answer
  • Which of the following is a valid IP address that can be used on the Internet (meaning the public addressing scheme)? Group of a
    10·1 answer
  • Lisa has a section of her document that she would like to include in the index. Which option should Lisa choose?
    5·2 answers
  • If a program compiles fine, but it produces an incorrect result, then the program suffers from _______________.
    11·1 answer
  • What is the name of the first practical asymmetric cryptosystem that was created?
    15·1 answer
  • What is nested selection?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!