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
Bobby is investigating how an authorized database user is gaining access to information outside his normal clearance level. Bobb
Sveta_85 [38]

Answer:

Aggregate Function .

Explanation:

The aggregate function returns the single value of the entire column of the database management system. The Aggregate Function is used in the SELECT statement and the GROUP BY clause.  

The sum(),avg(), etc are some examples of Aggregate Function in the database with the help of aggregate function bobby gains the access to information above the usual clearance point. and summarizes the data.

7 0
3 years ago
a 50.5 force is applied to a golf ball generating an initial acceleration of 15 m/s2 caculate the mass of the golf ball.
siniylev [52]

Answer:

Mass = 3.37 Kg

Explanation:

<u>Given the following data;</u>

Force = 50.5N

Acceleration = 15m/s²

To find the mass of the golf ball;

Force is given by the multiplication of mass and acceleration.

Mathematically, the formula for force is;

F = ma

Where;

  • F represents force measured in Newton.
  • m represents the mass of an object measured in kilograms.
  • a represents acceleration measured in meter per seconds square.

Making mass (m) the subject of formula, we have;

Mass (m) = \frac{F}{a}

Substituting into the equation;

Mass (m) = \frac{50.5}{15}

<em>Mass = 3.37 Kg</em>

7 0
3 years ago
What does this symbol “=“ mean
ikadub [295]

it means equals thanks for the free points

8 0
3 years ago
Read 2 more answers
A site has been issued the IP address of 192. 168. 10. 0/24. The largest network contained 25 hosts and was given the lowest num
dimulka [17.4K]

Answer:

Explanation: The first thing to calculate is what IP addresses are used by the largest LAN. Because the LAN has 100 hosts, 7 bits must be left for host bits.

Explanation:

Explanation: The first thing to calculate is what IP addresses are used by the largest LAN. Because the LAN has 100 hosts, 7 bits must be left for host bits.

4 0
2 years ago
Does anyone know how I can fix this? It keeps saying that it’s an illegal start of an expression and that it is missing an ; at
tangare [24]

Answer:

Use stackoverflow it's a website for proggramers

7 0
3 years ago
Other questions:
  • What folder is used to store offline files and folders managed by the offline files utility?
    15·1 answer
  • During slide show mode, hitting the B key will do which of these things?
    14·2 answers
  • when a page contains function is loaded the browser by passes the function without running it - true or false
    7·1 answer
  • Janis is preparing a financial document. She needs to use the dollar symbol placed above the number key 4. Which key will Janis
    14·1 answer
  • This project involves writing a program that encodes and decodes messages. The program should prompt the user to select whether
    15·1 answer
  • Which page feature is used in long documents to assist readers in quickly finding information in the document without having to
    11·2 answers
  • Evaluate the following expression: <br> 12+(2**4-5)/2Required to answer. Single choice.
    10·1 answer
  • A company has four departments: A, B, C, and D. The number of IP addresses required by each department is 100, 60, 20, and 26 re
    5·1 answer
  • Write a program that asks the user for a word. Next, open up the movie reviews.txt file and examine every review one at a time.
    6·1 answer
  • What is non verbal communication ?​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!