SSEC-Coding Contest Problem 2

Editorial For SSEC-Coding Contest

Problem Link:

SSEC0002

Author: Pavan Kumar
Problem Setter : Harsh

Difficulty: Easy-Medium

PREREQUISITES: Basic Looping Concepts

Problem:

Print the following pattern :-

     0
    505
   45054
  3450543
 234505432
12345054321

Solution:

Language: Python

n = int(input())
for i in range(0, n+1):
       print(" “*(n-i), end=”")
       for j in range(-i, i+1):
             print(n-abs(j)+1 if j!=0 else 0, end="")
       print("")