Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#Python 2, 67 bytes

Python 2, 67 bytes

def f(a,b):c="|"+"-"*(a-2)+"|\n";print c+c.replace("-"," ")*(b-2)+c

Examples

f(3,3)
|-|
| |
|-|
f(5,8)
|---|
| |
| |
| |
| |
| |
| |
|---|
f(10,3)
|--------|
| |
|--------|

#Python 2, 67 bytes

def f(a,b):c="|"+"-"*(a-2)+"|\n";print c+c.replace("-"," ")*(b-2)+c

Examples

f(3,3)
|-|
| |
|-|
f(5,8)
|---|
| |
| |
| |
| |
| |
| |
|---|
f(10,3)
|--------|
| |
|--------|

Python 2, 67 bytes

def f(a,b):c="|"+"-"*(a-2)+"|\n";print c+c.replace("-"," ")*(b-2)+c

Examples

f(3,3)
|-|
| |
|-|
f(5,8)
|---|
| |
| |
| |
| |
| |
| |
|---|
f(10,3)
|--------|
| |
|--------|
Source Link
ElPedro
  • 6.5k
  • 2
  • 26
  • 39

#Python 2, 67 bytes

def f(a,b):c="|"+"-"*(a-2)+"|\n";print c+c.replace("-"," ")*(b-2)+c

Examples

f(3,3)
|-|
| |
|-|
f(5,8)
|---|
| |
| |
| |
| |
| |
| |
|---|
f(10,3)
|--------|
| |
|--------|

AltStyle によって変換されたページ (->オリジナル) /