Algorithm


Problem Name: Python - Triangle Quest 2

Problem Link: https://www.hackerrank.com/challenges/triangle-quest-2/problem?isFullScreen=true  

In this HackerRank Functions in PYTHON problem solution,

You are given a positive integer N.

Your task is to print a palindromic triangle of size N.

For example, a palindromic triangle of size 5 is:

1
121
12321
1234321
123454321

 

You can't take more than two lines. The first line (a for-statement) is already written for you.
You have to complete the code using exactly one print statement.

Note:
Using anything related to strings will give a score of 0.

Using more than one for-statement will give a score of 0.

Input Format

A single line of input containing the integer N.

Constraints

  • 0 < N <10

Output Format

Print the palindromic triangle of size N as explained above.

Sample Input

5

Sample Output

1
121
12321
1234321
123454321

 

 

 

 

 

Code Examples

#1 Code Example with Python Programming

Code - Python Programming


print(((10**i)//9)**2)
Copy The Code & Try With Live Editor
Advertisements

Demonstration


Previous
[Solved] Piling Up! in PYTHON solution in Hackerrank
Next
[Solved] Iterables and Iterators in PYTHON solution in Hackerrank