Return an xmas tree n
rows in length.
n
will always be greater than 0.
Examples:
(1) => *
(3) =>
*
***
*****
(5) =>
*
***
*****
*******
*********
*^You can assume that you will always recieved valid input
Return an xmas tree n
rows in length.
n
will always be greater than 0.
Examples:
(1) => *
(3) =>
*
***
*****
(5) =>
*
***
*****
*******
*********
*^You can assume that you will always recieved valid input
Language: Haskell
Length: 65
A little late for Christmas, but still in December. :-)
t n=unlines$map(\h->replicate(n-h)' '++replicate(2*h-1)'*')[1..n]
Language: Python 2.7
Length: 53
Solution:
Just realised that I need to return a value and not print it.
Language: Python 2.7
Length: 68
Solution: