Comments on Tile pyramids on top of each other!
Parent
Tile pyramids on top of each other!
The task
Given a positive integer as input, output tiled pyramids of this height.
How?
Let's say the inputted integer was n
. From there, we output n
lines of output, each having:
- A decreasing indentation of spaces starting with
n-1
spaces and ending with0
spaces - An increasing number of the symbol
/
starting with1
symbol and ending withn
symbols - An increasing number of the symbol
\
starting with1
symbol and ending withn
symbols
For example, with an input of 4, the output should be the following:
/\
//\\
///\\\
////\\\\
Rules
- You may output an optional newline after the required output
- Input will always be a positive integer
- This is code-golf, so lowest byte-count for each language is the winner
Test cases
Input: 1
Output:
/\
Input: 7
Output:
/\
//\\
///\\\
////\\\\
/////\\\\\
//////\\\\\\
///////\\\\\\\
Input: 11
Output:
/\
//\\
///\\\
////\\\\
/////\\\\\
//////\\\\\\
///////\\\\\\\
////////\\\\\\\\
/////////\\\\\\\\\
//////////\\\\\\\\\\
///////////\\\\\\\\\\\
[V (vim)], 11 bytes ÀñY …
4y ago
AppleScript, 264 bytes Sue …
4y ago
Vyxal `C`, 6 bytes ``` ƛ\/ …
3y ago
[Ruby], 43 bytes -> …
4y ago
Japt `-R`, 12 bytes õÈ" …
4y ago
C (compliant), 106 bytes …
4y ago
[Python 2], 57 bytes …
4y ago
Canvas, 9 7 bytes H/×║∔} …
4y ago
[JavaScript (Node.js)], 57 56 …
4y ago
Post
Python 2, 57 bytes
a,x=1,input()
exec'print" "*(x-a)+"/"*a+"\\\\"*a;a+=1;'*x
Prints it out line by line
1 comment thread