Diamond of Stars
Programs with input · Advanced · about 15 min
Read a size n and print a diamond of stars. The top half has n rows: row i (counting from 1) starts with n - i spaces, followed by 2 * i - 1 stars, so the widest row has no spaces in front. The bottom half repeats the rows above the widest one, in reverse order. Print no spaces after the stars.
If the size is less than 1, print Size must be at least 1.
The prompts inside input() are not checked, only what you print.
Example
You type:
3The program prints:
* *** ***** *** *
n = int(input("Size: "))
# Print the diamond
The solution opens after your first Check.