Python Exercise: Construct a specified pattern, using a nested for loop
4. Construct Pattern (Diamond Pattern)
Write a Python program to construct the following pattern, using a nested for loop.
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
Pictorial Presentation:

Sample Solution:
Python Code:
Sample Output:
* * * * * * * * * * * * * * * * * * * * * * * * *
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to print a pyramid pattern of stars that first increases then decreases using nested loops.
- Write a Python program to construct a diamond shape pattern with asterisks, where the widest row is the middle row.
- Write a Python program to generate a symmetric star pattern that has an even number of rows and mirror-image halves.
- Write a Python program to create an hourglass pattern using a nested for loop, with stars decreasing then increasing in count.
Go to:
Previous: Write a Python program to guess a number between 1 to 9.
Next: Write a Python program that accepts a word from the user and reverse it.
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.