Jovian
⭐️
Sign In
In [ ]:
#You are given a positive integer N.
#Task is to print a palindromic traingle if size N
In [1]:
import numpy as np
In [3]:
for i in np.arange(5)+1:
    if i ==1:
        print(i)
    else:
        mstr=""
        rstr=""
        for j in np.arange(i+(i-1))+1:
            if j<i:
                mstr += (j%i).astype(str)
            elif j==i:
                rstr = mstr[::-1]
                mstr += (j).astype(str)
        mstr += rstr
        print(mstr)
1 121 12321 1234321 123454321
In [4]:
import jovian
In [ ]:
jovian.commit()
[jovian] Saving notebook..
In [ ]: