Skip to main content
Commonmark migration
Source Link

#Python 2, 238 chars

Python 2, 238 chars

i=input()
m=["+"+"-"*(i*4+1)+"+","|"+" "*(i*4+1)+"|"]
for v in range(i,1,-1):
 m+=[" "*(i-v)*2+"+"+"-"*(v*4+1)+"+"," "*(i-v+1)*2+"|"+" "*((v-1)*4+1)+"|"]
m.pop()
m+=[" "*(i-1)*2+"|"+" "*5+"|"," "*(i-1)*2+" _|_|_"]
print'\n'.join(m[::-1])

The missing example of Cake 2:

   _|_|_
  |     |
+---------+
|         |
+---------+

#Python 2, 238 chars

i=input()
m=["+"+"-"*(i*4+1)+"+","|"+" "*(i*4+1)+"|"]
for v in range(i,1,-1):
 m+=[" "*(i-v)*2+"+"+"-"*(v*4+1)+"+"," "*(i-v+1)*2+"|"+" "*((v-1)*4+1)+"|"]
m.pop()
m+=[" "*(i-1)*2+"|"+" "*5+"|"," "*(i-1)*2+" _|_|_"]
print'\n'.join(m[::-1])

The missing example of Cake 2:

   _|_|_
  |     |
+---------+
|         |
+---------+

Python 2, 238 chars

i=input()
m=["+"+"-"*(i*4+1)+"+","|"+" "*(i*4+1)+"|"]
for v in range(i,1,-1):
 m+=[" "*(i-v)*2+"+"+"-"*(v*4+1)+"+"," "*(i-v+1)*2+"|"+" "*((v-1)*4+1)+"|"]
m.pop()
m+=[" "*(i-1)*2+"|"+" "*5+"|"," "*(i-1)*2+" _|_|_"]
print'\n'.join(m[::-1])

The missing example of Cake 2:

   _|_|_
  |     |
+---------+
|         |
+---------+
more obvious stuff
Source Link

#Python 2, 263238 chars

i=input()
m=["+"+"-"*(i*4+1)+"+","|"+" "*(i*4+1)+"|"]
for v in range(i,1,-1):
 m+=[" "*((i-v)*2)+"+"+"*2+"+"+"-"*(v*4+1)+"+"," "*((i-v+1)*2)+"|"+"*2+"|"+" "*((v-1)*4+1)+"|"]
m.pop()
m+=[" "*((i-1)*2)+"|"+"*2+"|"+" "*5+"|","\n"+"" "*((i-1)*2)+"*2+" _"+"|"+"_"+"|"+"_"]_|_|_"]
print'\n'.join(m[::-1])

The missing example of Cake 2:

   _|_|_
  |     |
+---------+
|         |
+---------+

#Python 2, 263 chars

i=input()
m=["+"+"-"*(i*4+1)+"+","|"+" "*(i*4+1)+"|"]
for v in range(i,1,-1):
 m+=[" "*((i-v)*2)+"+"+"-"*(v*4+1)+"+"," "*((i-v+1)*2)+"|"+" "*((v-1)*4+1)+"|"]
m.pop()
m+=[" "*((i-1)*2)+"|"+" "*5+"|","\n"+" "*((i-1)*2)+" _"+"|"+"_"+"|"+"_"]
print'\n'.join(m[::-1])

The missing example of Cake 2:

   _|_|_
  |     |
+---------+
|         |
+---------+

#Python 2, 238 chars

i=input()
m=["+"+"-"*(i*4+1)+"+","|"+" "*(i*4+1)+"|"]
for v in range(i,1,-1):
 m+=[" "*(i-v)*2+"+"+"-"*(v*4+1)+"+"," "*(i-v+1)*2+"|"+" "*((v-1)*4+1)+"|"]
m.pop()
m+=[" "*(i-1)*2+"|"+" "*5+"|"," "*(i-1)*2+" _|_|_"]
print'\n'.join(m[::-1])

The missing example of Cake 2:

   _|_|_
  |     |
+---------+
|         |
+---------+
more good advice
Source Link

#Python 32, 273263 chars

i=int(inputi=input())
m=["+"+"-"*(i*4+1)+"+","|"+" "*(i*4+1)+"|"]
for v in range(i,1,-1):
    m+=[" "*((i-v)*2)+"+"+"-"*(v*4+1)+"+"," "*((i-v+1)*2)+"|"+" "*((v-1)*4+1)+"|"]
m.pop()
m+=[" "*((i-1)*2)+"|"+" "*5+"|","\n"+" "*((i-1)*2)+" _"+"|"+"_"+"|"+"_"]
print('\n'print'\n'.join(m[::-1]))

The missing example of Cake 2:

   _|_|_
  |     |
+---------+
|         |
+---------+

#Python 3, 273 chars

i=int(input())
m=["+"+"-"*(i*4+1)+"+","|"+" "*(i*4+1)+"|"]
for v in range(i,1,-1):
    m+=[" "*((i-v)*2)+"+"+"-"*(v*4+1)+"+"," "*((i-v+1)*2)+"|"+" "*((v-1)*4+1)+"|"]
m.pop()
m+=[" "*((i-1)*2)+"|"+" "*5+"|","\n"+" "*((i-1)*2)+" _"+"|"+"_"+"|"+"_"]
print('\n'.join(m[::-1]))

The missing example of Cake 2:

   _|_|_
  |     |
+---------+
|         |
+---------+

#Python 2, 263 chars

i=input()
m=["+"+"-"*(i*4+1)+"+","|"+" "*(i*4+1)+"|"]
for v in range(i,1,-1):
 m+=[" "*((i-v)*2)+"+"+"-"*(v*4+1)+"+"," "*((i-v+1)*2)+"|"+" "*((v-1)*4+1)+"|"]
m.pop()
m+=[" "*((i-1)*2)+"|"+" "*5+"|","\n"+" "*((i-1)*2)+" _"+"|"+"_"+"|"+"_"]
print'\n'.join(m[::-1])

The missing example of Cake 2:

   _|_|_
  |     |
+---------+
|         |
+---------+
obvious optimizations
Source Link
Loading
thanks
Source Link
Loading
added 2 characters in body
Source Link
DJMcMayhem
  • 59.6k
  • 17
  • 196
  • 348
Loading
Source Link
Loading