Technology

Triangle Quest in Python – Solution

By December 29, 2015 No Comments

I came across a programming puzzle in which we are given a positive integer N (0 < N< 10). we need to print a palindromic triangle of size N.

For example if N = 5 then the expected output is

[dt_code]1
121
12321
1234321
123454321[/dt_code]

Below is my solution written in python:

**Note that the above code is written for python 3, so if you are using python 2.* then replace input by raw_input and the code should work fine. 🙂

Naveen

Author Naveen

A Computer Science graduate student, a programmer, photographer, reader and blogger

More posts by Naveen

Leave a Reply