Input Format
A single line of input containing the integer .
Constraints
Output Format
Print the palindromic triangle of size  as explained above.

hackerrank traingle quest 2 problem solution in python programming

Problem solution in Python 3 programming language.

for i in xrange(1,int(input())+1):
    print((10**i/9)**2)

Second solution

for i in range(1,int(input())+1): print(reduce(lambda x, y: x + (10 ** (y - 1)), range(1, i + 1))**2)

Third solution

for i in range(1,int(input())+1):
    print([1, 121, 12321, 1234321, 123454321, 12345654321,1234567654321, 123456787654321, 12345678987654321][i-1])

Problem solution in Python 2 programming language.

for i in xrange(1,int(raw_input())+1):
    print (10**i/9)**2

Second solution

for i in range(1,int(raw_input())+1): print reduce(lambda x, y: x + (10 ** (y - 1)), range(1, i + 1))**2

Third solution

for i in range(1,int(raw_input())+1): 
    print [1, 121, 12321, 1234321, 123454321, 12345654321,1234567654321, 123456787654321, 12345678987654321][i-1]