###Task:

You have to write a function `pattern` which creates the following pattern (see examples) up to the desired number of rows.

* If the Argument is 0 or a Negative Integer then it should return "" i.e. empty string.

* If any even number is passed as argument then the pattern should last upto the largest odd number which is smaller than the passed even number.

###Examples:

pattern(9):

    1
    333
    55555
    7777777
    999999999

pattern(6):

    1
    333
    55555

```Note: There are no spaces in the pattern```

```Hint: Use \n in string to jump to next line```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def pattern(n):
	

Solutions:
def pattern(n):
	return '\n'.join((str(i) * i for i in range(1, n + 1, 2)))


def pattern(n):
	string = ''
	a = n
	if a % 2 == 0:
		a -= 1
	for x in range(1, a + 1):
		if x % 2 != 0:
			string += str(x) * x
			if x != a:
				string += '\n'
	return string


def pattern(n):
	return '\n'.join([str(num) * num for num in range(1, n + 1, 2)])


pattern = lambda n: '\n'.join([str(x) * x for x in range(1, n + 1, 2)])


def pattern(n):
	x = []
	if n <= 0:
		return ''
	else:
		for a in range(1, n + 1, 2):
			x.append(str(a) * a)
	return '\n'.join(x)


def pattern(n):
	return '' if n <= 0 else '\n'.join([str(i) * i for i in range(1, n + 1, 2)])


def pattern(n):
	return '\n'.join((str(x) * x for x in range(1, n + 1, 2)))


pattern = lambda n: '\n'.join((str(a) * a for a in range(1, n + 1, 2)))