14
4
Challenge
Given an input n
, print an ASCII art cake n
layers tall, viewed from the side, with two candles on top. Refer to the examples below for details.
Output
>> cake(1)
_|_|_
| |
+-----+
>> cake(3)
_|_|_
| |
+---------+
| |
+-------------+
| |
+-------------+
...and so on.
Rules
- Standard loopholes prohibited
- Please make an attempt at a clever solution
- This is code-golf, so shortest answer in bytes wins. However, the answer will not be selected.
Hello, and welcome to the site! You could take input from STDIN and take off 24 chars. For example,
i=int(input())
– James – 2016-09-17T05:59:13.230If you want, you should be able to change to Python 2 and change
int(input())
toinput()
and theprint
statement, plus you can change the four spaces to one (if it's a tab, change it to a space to make it more obvious that it's one character). Plus your bytecount is 4 too high for some reason. – ASCII-only – 2016-09-17T06:29:38.557@Mars Ultor oops, yes, I'm not sure why I chose python 3 to begin with. Thanks. – edelbitter – 2016-09-17T06:45:51.810
You may also be able to save a few bytes using percent formatting – ASCII-only – 2016-09-17T06:54:14.650