This is now a little serie :)

Funny Dots

You will get two Integer n (width) and m (height) and your task is to draw following pattern. Each line is seperated with '\n'.

Both integers are equal or greater than 1. No need to check for invalid parameters.

e.g.:



                                          +---+---+---+
            +---+                         | o | o | o |
dot(1,1) => | o |          dot(3,2) =>    +---+---+---+            
            +---+                         | o | o | o |
                                          +---+---+---+


 Serie: ASCII Fun

ASCII Fun #1: X-Shape
ASCII Fun #2: Funny Dots
ASCII Fun #3: Puzzle Tiles
ASCII Fun #4: Build a pyramid

Source: codewars | Difficulty: EASY
Tags: String algorithms

Starter code: def dot(n,m):
	

Solutions:
def dot(n, m):
	sep = '+---' * n + '+'
	dot = '| o ' * n + '|'
	return '\n'.join([sep, dot] * m + [sep])


def dot(n, m):
	result = ['+---' * n + '+' + '\n' + '| o ' * n + '|' for i in range(m)]
	result.append('+---' * n + '+')
	return '\n'.join(result)


def dot(n, m):
	sep = '---'.join('+' * (n + 1))
	dot = ' o '.join('|' * (n + 1))
	return f'\n{dot}\n'.join([sep for _ in range(m + 1)])


def dot(w, h):
	(sep, row) = ('+---' * w + '+\n', '| o ' * w + '|\n')
	return (sep + row) * h + sep.strip()


def dot(n, m):
	sep = '+' + '+'.join(['---'] * n) + '+'
	bod = '|' + '|'.join([' o '] * n) + '|'

	def f():
		yield sep
		for i in range(m):
			yield bod
			yield sep
	return '\n'.join(f())


def dot(n, m):
	inter = '\n' + '+' + '+'.join(('---' for i in range(n))) + '+' + '\n'
	bigo = '|' + '|'.join((' o ' for i in range(n))) + '|'
	return (inter + inter.join((bigo for i in range(m))) + inter)[1:-1]


def dot(n, m):
	return '\n'.join(['+---+' * n, '| o |' * n] * m).replace('||', '|').replace('++', '+') + '\n' + ('+---+' * n).replace('++', '+')


def dot(n, m):
	return f"\n{' o '.join(['|'] * (n + 1))}\n".join(['---'.join(['+'] * (n + 1))] * (m + 1))


dot = lambda n, m: ' o '.join(-~n * '|').join(2 * '\n').join(-~m * ['---'.join(-~n * '+')])


dot = lambda n, m: ('+---' * n + '+\n' + '| o ' * n + '|\n') * m + '+---' * n + '+'