# Python Program to Print a Number Diamond

## Diamond

Given an integer value N, write a program to print a number diamond of 2*N -1 rows as shown below.

Input

The first line of input is an integer N

Explanation

In the given example, the number of rows in the diamond is 5 So, the output should be

``````. . . . 0 . . . .
. . . 0 0 0 . . .
. . 0 0 0 0 0 . .
. 0 0 0 0 0 0 0 .
0 0 0 0 0 0 0 0 0
. 0 0 0 0 0 0 0 .
. . 0 0 0 0 0 . .
. . . 0 0 0 . . .
. . . . 0 . . . . ``````

Sample Input
3

Sample Output

``````. . 0 . .
. 0 0 0 .
0 0 0 0 0
. 0 0 0 .
. . 0 . . ``````

Code:

``````n=int(input())
for row in range(n):
print(". "*(n-row-1),end="")
print("0 "*(row+1),end="")
print("0 "*(row),end="")
print(". "*(n-row-1),end="")
print()
for row in range(n-1,0,-1):
print(". "*(n-row),end="")
print("0 "*(row),end="")
print("0 "*(row-1),end="")
print(". "*(n-row),end="")
print()``````

Input
8

Output

``````. . . . . . . 0 . . . . . . .
. . . . . . 0 0 0 . . . . . .
. . . . . 0 0 0 0 0 . . . . .
. . . . 0 0 0 0 0 0 0 . . . .
. . . 0 0 0 0 0 0 0 0 0 . . .
. . 0 0 0 0 0 0 0 0 0 0 0 . .
. 0 0 0 0 0 0 0 0 0 0 0 0 0 .
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
. 0 0 0 0 0 0 0 0 0 0 0 0 0 .
. . 0 0 0 0 0 0 0 0 0 0 0 . .
. . . 0 0 0 0 0 0 0 0 0 . . .
. . . . 0 0 0 0 0 0 0 . . . .
. . . . . 0 0 0 0 0 . . . . .
. . . . . . 0 0 0 . . . . . .
. . . . . . . 0 . . . . . . . ``````

## Python Program to Convert Integer into a Single Numeral

Single Digit Number Ram is given a positive integer N .He wishes to convert this integer into a single numeral. He does so by repeatedly adding the…

## Python Program to Print Armstrong numbers between two intervals￼

Write a program to print all the Armstrong numbers in the given range A to B (including A and B). An N – digit number is an…

## Python Program to Check if Given Input is a Letter, Digit or Special Character￼

Letter, Digit or Special Character You are given a character as input. Check if the given input is a Lowercase Letter or Uppercase Letter or Digit or…

## Interleave Strings | Python Program to merge two strings by adding characters in alternating order

Interleave Strings Given two strings, write a program to merge the given two strings by adding characters in alternating order, starting with the first string. If a…

## Python Program to Check if given colors are present in the color palate

Shekhar is an artist. He likes to draw and paint. He is now drawing a portrait of a city road which is in the black color and…

## Python Program to Check the eligibility criteria for donor

Python Comparison Operators An XYZ hospital has organised a blood donation camp. The eligibility criteria for donor was as follows  1) Age>=18  2) Weight >=50 kg  3)…