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
The programs that provide the infrastructure and hardware control necessary for the computer and its peripheral devices are call
Vinil7 [7]

Answer:

System Software

Explanation:

Anything on your computer that includes system services, configuration files, and many other computer preferences is called system software. System software like the operating systems themselves, browsing software, and many other software programs offers platform to other software. It falls in between the user and the hardware. Once your Operating System is installed, the system software comes preinstalled. System software constitutes every program file on your computer that interacts in a very basic level with the hardware.

8 0
3 years ago
What is an example of a transition effectl
yawa3891 [41]
Well try finding out what transition effect means 
8 0
3 years ago
A customer would like you to install a high-end video card suitable for gaming. Your installation and configuration SHOULD inclu
Snowcat [4.5K]

Answer: • Ensure that the video card is compatible with the expansion slot

• Install video drivers from CD and then install updated drivers from the internet

• Configure the PC to use the integrated graphics if available and needed

Explanation

Your question isn't complete as you didn't put the options but I got the options online and the correct answers have been provided.

The installation and configuration for the high-end video card suitable for gaming will include:

• Ensure that the video card is compatible with the expansion slot

• Install video drivers from CD and then install updated drivers from the internet

• Configure the PC to use the integrated graphics if available and needed

4 0
3 years ago
What is the limitation of computer<br>​
eimsori [14]

The limitation of computer are:

  1. No self-intelligence
  2. No feeling
  3. No learning power
  4. Dependency

3 0
3 years ago
Discussion Topic
BabaBlast [244]

Answer:

Social media positively affects and impacts the process of globalization. ... Global communities is a social infrastructure tool and as social media helps in strengthening social relationships and bringing people and communities together it leads to creating a string global community.

7 0
3 years ago
Other questions:
  • Harry is creating a presentation for a school event. He has to deliver the presentation to a huge audience. What should he keep
    14·2 answers
  • What is a bus master?
    14·1 answer
  • A software program that enables users to find and display information stored as html pages on the internet is a(n) ____.
    5·1 answer
  • JavaScript
    10·1 answer
  • Please help
    14·1 answer
  • Drag the tiles to the correct boxes to complete the pairs.
    13·1 answer
  • Given an integer n and an array a of length n, your task is to apply the following mutation to an: Array a mutates into a new ar
    5·1 answer
  • What does FLUX do when soldering an electrical joint?
    13·2 answers
  • Which statistical function in a spreadsheet helps you to see how far each number varies, on average, from the average value of t
    5·1 answer
  • Which statement best describes desktop publishing?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!