write me a function `stringy` that takes a `size` and returns a `string` of alternating `'1s'` and `'0s'`.

the string should start with a `1`.

a string with `size` 6 should return :`'101010'`.

with `size` 4 should return : `'1010'`.

with `size` 12 should return : `'101010101010'`.

The size will always be positive and will only use whole numbers.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Bit manipulation

Starter code: def stringy(size):
	

Solutions:
def stringy(size):
	return ''.join([str(i % 2) for i in range(1, size + 1)])


def stringy(size):
	return ('10' * size)[:size]


from itertools import cycle, islice

def stringy(size):
	return ''.join(islice(cycle('10'), size))


def stringy(size):
	s = ''
	for x in range(0, size):
		s += str('1') if x % 2 == 0 else str('0')
	return s


def stringy(size):
	return '10' * (size // 2) + '1' * (size % 2)


def stringy(size):
	return '10' * (size // 2) if size % 2 == 0 else '10' * (size // 2) + '1'


def stringy(size):
	res = ''
	for x in range(0, size):
		res += '1' if x % 2 == 0 else '0'
	return res


def stringy(size):
	str = ''
	while len(str) < size:
		str += '1'
		if len(str) < size:
			str += '0'
	return str


stringy = lambda size: ('10' * (size // 2 + 1))[:size]


def stringy(size):
	arr = []
	for i in range(size):
		if i % 2 == 0:
			arr.append('1')
		else:
			arr.append('0')
	return ''.join(arr)


stringy = lambda size: ('10' * size)[:size]


ONE_ZERO = '10'

def stringy(size):
	return ''.join((ONE_ZERO[a % 2] for a in range(size)))


def stringy(size: int) -> str:
	return ''.join([str(_ % 2) for _ in range(1, size + 1)])


def gen():
	while True:
		yield '1'
		yield '0'

def stringy(size):
	g = gen()
	return ''.join((next(g) for _ in range(size)))


stringy = lambda n: ('10' * n)[:n]


def stringy(size):
	return ''.join(['1' if a % 2 == 0 else '0' for a in range(size)])


def stringy(size):
	return ''.join([str((a + 1) % 2) for a in range(size)])


def stringy(size):
	binary = '10'
	s = size * binary
	return s[:size]


def stringy(size):
	return ''.join(map(str, map(int, map(lambda x: not x % 2, range(size)))))


def stringy(size):
	if size % 2 == 0:
		return '10' * int(size / 2)
	else:
		x = size - 1
		return '10' * int(x / 2) + '1'


def stringy(size):
	return ''.join(('{:d}'.format(not i % 2) for i in range(size)))


def stringy(size):
	return ('1' * size).replace('11', '10')


def stringy(size):
	return __import__('re').sub('11', '10', '1' * size)


def stringy(size):
	ans = ''
	for place in range(size):
		if place % 2 == 0:
			ans += '1'
		else:
			ans += '0'
	return ans


def stringy(size):
	string = ''
	for num in range(size):
		if num % 2 == 0:
			string += '1'
		else:
			string += '0'
	return string


def stringy(size):
	return str('10' * size)[:size]


def stringy(size):
	x = True
	s = ''
	while size > 0:
		s += str(int(x))
		x = not x
		size -= 1
	return s


def stringy(size):
	output_string = ''
	for i in range(size):
		if i % 2 == 0:
			output_string += '1'
		else:
			output_string += '0'
	return output_string


def stringy(size):
	n = int(size / 2)
	i = 0
	c = '10'
	output = ''
	for i in range(n):
		output = output + c
		i += 1
	if size % 2 == 1:
		output = output + '1'
	return output


def stringy(size):
	st = '1'
	i = 0
	while i < size - 1:
		if st[i] == '1':
			st = st + '0'
		else:
			st = st + '1'
		i += 1
	return st


def stringy(size):
	strng = ''
	if size % 2 == 1:
		for i in range((size + 1) // 2):
			strng += '10'
		return strng[:-1]
	else:
		for i in range(size // 2):
			strng += '10'
		return strng


def stringy(size):
	counter = 0
	res = ''
	while counter < size:
		if counter % 2 == 0:
			res += '1'
			counter += 1
		elif counter % 2 == 1:
			res += '0'
			counter += 1
	return res


def stringy(size):
	(start, result) = ('1', '')
	for i in range(size):
		result += start
		start = '1' if start == '0' else '0'
	return result


def stringy(size):
	x = 0
	list_size = []
	for i in range(size):
		if x % 2:
			i = 0
		else:
			i = 1
		x += 1
		list_size.append(i)
	return str(''.join(map(str, list_size)))


def stringy(size):
	temp = ''
	for el in range(size):
		if el % 2:
			temp += '0'
		else:
			temp += '1'
	return temp


def stringy(size):
	c = 0
	res = ''
	for i in range(size):
		c += 1
		if i == 0:
			res += '1'
		elif i == 1:
			res += '0'
		elif i % 2 == 0:
			res += '1'
		else:
			res += '0'
	return res


def stringy(size):
	return ''.join((str(el % 2) for el in range(1, size + 1)))


def stringy(size):
	string = '1'
	for (number, index) in enumerate(range(0, size - 1)):
		print(string)
		if index % 2 == 0:
			string = string + '0'
		else:
			string = string + '1'
	return string


def stringy(size):
	value = True
	result = ''
	for i in range(size):
		result += str(int(value))
		value = not value
	return result


def stringy(size):
	size - int(size)
	counter = 1
	word = ''
	while len(word) < size:
		if counter % 2 == 0:
			word = word + '0'
		if counter % 2 != 0:
			word = word + '1'
		counter += 1
	return word


def stringy(size):
	s = ''
	for i in range(0, size):
		if i % 2 == 0:
			j = '1'
			s = s + j
		else:
			j = '0'
			s = s + j
	return s


def stringy(size):
	st = ''
	while size > 0:
		st += '1'
		size -= 1
		if size < 1:
			break
		st += '0'
		size -= 1
	return st


def stringy(size):
	return ''.join((str(x & 1) for x in range(1, size + 1)))


def stringy(size):
	print(size)
	bla = ''
	for i in range(int(size)):
		if i % 2 != 0:
			bla += str(0)
		else:
			bla += str(1)
	print(bla)
	return bla
size = 3
stringy(size)


def stringy(size):
	arr = []
	cnt = 0
	while True:
		arr.append('1')
		cnt += 1
		if cnt == size:
			break
		arr.append('0')
		cnt += 1
		if cnt == size:
			break
	return ''.join(arr)


import math

def stringy(size):
	return str('10' * math.ceil(size / 2))[:size]


def stringy(size):
	result = '10' * (size // 2)
	if size % 2 == 1:
		result = result + '1'
	return result


from math import ceil

def stringy(size):
	return '10' * (size // 2) if size % 2 == 0 else str('10' * ceil(size / 2))[:-1]


stringy = lambda l: '10' * (l // 2) + '1' * (l % 2)


def stringy(size):
	x = ''
	while len(x) < size:
		x += '1'
		if len(x) < size:
			x += '0'
	return x


def stringy(size):
	string = ''
	if size % 2 == 0:
		return '10' * int(size / 2)
	else:
		return str('10' * int(size / 2 + 1))[:-1]


def stringy(size):
	x = ''
	n = 1
	while n <= size:
		if n % 2 == 1:
			x += '1'
			n += 1
		else:
			x += '0'
			n += 1
	return x


def stringy(size):
	alot = '10' * 1000
	return alot[0:int(size)]


def stringy(size):
	count = 3
	arr = ''
	for i in range(size):
		if count % 2 == 1:
			arr += '1'
			count += 1
		else:
			arr += '0'
			count += 1
	return arr


def stringy(size):
	(c, l) = ('1', [])
	for i in range(size):
		if c == '1':
			l.append(c)
			c = '0'
		elif c == '0':
			l.append(c)
			c = '1'
	return ''.join(l)


def stringy(size):
	for x in range(1, size + 1, 1):
		if x == 1:
			t = '1'
		elif t[-1] == '1':
			t += '0'
		else:
			t += '1'
	return t


def stringy(size):
	return '10' * int(size / 2) if not size % 2 else '10' * int(size / 2) + '1'


def stringy(size):
	res = ''
	n = 0
	while n < size:
		if n == size:
			break
		else:
			res += '1'
			n += 1
		if n == size:
			break
		else:
			res += '0'
			n += 1
	return res


def stringy(size):
	x = ''
	while size > len(x):
		x = x + '1'
		while size > len(x):
			x = x + '0'
			break
	return x


from itertools import islice, cycle

def stringy(size):
	return ''.join((str(i) for i in islice(cycle([1, 0]), 0, size)))


def stringy(size):
	if size == 1:
		return '1'
	elif size % 2 == 0:
		return '10' * (size // 2)
	elif size != 1 and size % 2 == 1:
		return '1' + '01' * (size // 2)


from math import ceil

def stringy(size):
	return '0'.join('1' * ceil(size / 2)) + '0' * ((size - 1) % 2)


def stringy(size):
	res = ''
	t = size
	while t > 0:
		if t % 2 == 1:
			res = '1' + res
		else:
			res = '0' + res
		t -= 1
	return res


def stringy(size):
	if size == 1:
		return '1'
	if size % 2 == 0:
		return '10' * int(size / 2)
	return '10' * int((size - 1) / 2) + '1'


def stringy(size):
	choices = [1, 0]
	a = ''
	for i in range(size):
		a += str(choices[i % 2])
	return a


def stringy(size):
	return ''.join([['1', '0'][loop % 2] for loop in range(size)])


def stringy(size):
	outStr = ''
	lastAdd = 0
	for x in range(size):
		if lastAdd == 0:
			outStr += str(1)
			lastAdd = 1
		else:
			outStr += str(0)
			lastAdd = 0
	return outStr


def stringy(size):
	i = 0
	list1 = ['1']
	for n in range(size - 1):
		if i % 2 == 0:
			list1.append('0')
			i += 1
		else:
			list1.append('1')
			i += 1
	return ''.join(list1)


def stringy(size):
	res = ''
	n = True
	for i in range(size):
		if n:
			res += '1'
			n = False
		else:
			res += '0'
			n = True
	return res


def stringy(size):
	S = ''
	nextChar = '1'
	for i in range(size):
		S += nextChar
		if nextChar == '1':
			nextChar = '0'
		else:
			nextChar = '1'
	return S


import math

def stringy(size):
	if size == 1:
		return '1'
	elif size % 2 == 0:
		return '10' * int(size / 2)
	else:
		return '10' * math.floor(size / 2) + '1'