Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
#Python 3, 104 95 bytes ( feedback from @mbomb007 : -9 bytes)
def d(x,y):return'\n'.join(('|'+('-'*(x-2)if n<1or n==~-y else' '*(x-2))+'|')for n in range(y))
(my first code golf, appreciate feedback)
( feedback from @mbomb007 : -9 bytes)
#Python 3, 104 95 bytes
#Python 3, 104104 95 bytes
def d(x,y):return '\n'return'\n'.join(('|'+('-'*(x-2)if n==0 orn<1or n==(yn==~-1) elsey 'else' '*(x-2))+'|') for n in range(0,y))
#Python 3, 104 bytes
def d(x,y):return '\n'.join(('|'+('-'*(x-2)if n==0 or n==(y-1) else ' '*(x-2))+'|') for n in range(0,y))