For every good kata idea there seem to be quite a few bad ones!

In this kata you need to check the provided array (x) for good ideas 'good' and bad ideas 'bad'. If there are one or two good ideas, return 'Publish!', if there are more than 2 return 'I smell a series!'. If there are no good ideas, as is often the case, return 'Fail!'.

~~~if:c
For C: do not dynamically allocate memory,
      instead return a string literal
~~~

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures

Starter code: def well(x):
	

Solutions:
def well(x):
	c = x.count('good')
	return 'I smell a series!' if c > 2 else 'Publish!' if c else 'Fail!'


def well(x):
	if x.count('good') == 0:
		return 'Fail!'
	elif x.count('good') <= 2:
		return 'Publish!'
	else:
		return 'I smell a series!'


def well(ideas):
	good_ideas = ideas.count('good')
	if good_ideas == 0:
		return 'Fail!'
	elif good_ideas < 3:
		return 'Publish!'
	return 'I smell a series!'


well = lambda x: ('Fail!', 'Publish!', 'I smell a series!')[('good' in x) + (x.count('good') > 2)]


def well(a):
	c = a.count('good')
	return ['Fail!', 'Publish!', 'I smell a series!'][(c > 0) + (c > 2)]


def well(x):
	return ['Fail!', 'Publish!', 'Publish!', 'I smell a series!'][min(3, x.count('good'))]


well = lambda a: ['Fail!', 'Publish!', 'I smell a series!'][min((a.count('good') + 1) // 2, 2)]


def well(x):
	y = 0
	for c in x:
		if c == 'good':
			y = y + 1
	if y == 0:
		return 'Fail!'
	if y > 2:
		return 'I smell a series!'
	return 'Publish!'


def well(x):
	if x.count('good') >= 3:
		return 'I smell a series!'
	elif x.count('good') >= 1:
		return 'Publish!'
	return 'Fail!'


def well(x):
	if x.count('good') > 2:
		return 'I smell a series!'
	if 'good' in x:
		return 'Publish!'
	return 'Fail!'


def well(ideas):
	good = 0
	for idea in ideas:
		if idea == 'good':
			if good > 1:
				return 'I smell a series!'
			good += 1
	return 'Publish!' if good else 'Fail!'


well = lambda x: 'I smell a series!' if x.count('good') > 2 else 'Publish!' if x.count('good') else 'Fail!'


well = lambda x: ('Fail!', 'Publish!', 'I smell a series!')[min(int(x.count('good') / 2 + 0.5), 2)]


def well(x):
	count = x.count('good')
	if count <= 2 and count >= 1:
		return 'Publish!'
	elif count > 2:
		return 'I smell a series!'
	else:
		return 'Fail!'


def well(x):
	goodIdeas = 0
	for k in x:
		if k == 'good':
			goodIdeas += 1
	if goodIdeas > 2:
		return 'I smell a series!'
	elif goodIdeas >= 1:
		return 'Publish!'
	else:
		return 'Fail!'


def well(x):
	n = x.count('good')
	return ('Fail!', 'Publish!', 'I smell a series!')[(n > 0) + (n > 2)]


def well(x):
	return {0: 'Fail!', 1: 'Publish!', 2: 'Publish!'}.get(x.count('good'), 'I smell a series!')


def well(x):
	(chk, l) = (x.count('good'), ['Fail!', 'Publish!', 'I smell a series!'])
	return [l[0], l[1], l[1]][chk] if chk < 3 else l[2]


def well(x):
	goods = x.count('good')
	return ['Fail!', 'Publish!', 'I smell a series!'][(goods > 2) + (goods >= 1)]


def well(x):
	good_count = 0
	for i in x:
		if i == 'good':
			good_count += 1
	if 0 < good_count <= 2:
		return 'Publish!'
	if good_count == 0:
		return 'Fail!'
	if good_count > 2:
		return 'I smell a series!'


def well(x):
	good_ideas = x.count('good')
	if not good_ideas:
		return 'Fail!'
	elif good_ideas <= 2:
		return 'Publish!'
	else:
		return 'I smell a series!'


def well(x):
	a = sum((1 for i in x if i == 'good'))
	if a == 1 or a == 2:
		return 'Publish!'
	elif a > 2:
		return 'I smell a series!'
	else:
		return 'Fail!'


def well(x):
	NG = 0
	for i in range(len(x)):
		if x[i] == 'good':
			NG += 1
	if NG > 2:
		return 'I smell a series!'
	elif NG >= 1:
		return 'Publish!'
	else:
		return 'Fail!'


def well(x):
	if x.count('bad') == len(x):
		return 'Fail!'
	if x.count('good') == 1 or x.count('good') == 2:
		return 'Publish!'
	else:
		return 'I smell a series!'


def well(x):
	if not 'good' in x:
		return 'Fail!'
	else:
		return 'Publish!' if x.count('good') < 3 else 'I smell a series!'


def well(x):
	counter = 0
	for i in x:
		if i.lower() == 'good':
			counter += 1
	if counter == 1 or counter == 2:
		return 'Publish!'
	elif counter > 2:
		return 'I smell a series!'
	elif counter < 1:
		return 'Fail!'


def well(x):
	v = len([i for i in x if i == 'good'])
	return 'Fail!' if v == 0 else 'I smell a series!' if v > 2 else 'Publish!'


def well(x):
	return 'I smell a series!' if sum((1 if i == 'good' else 0 for i in x)) > 2 else 'Publish!' if 3 > sum((1 if i == 'good' else 0 for i in x)) > 0 else 'Fail!'


def well(x):
	alfa = ('Fail!', 'Publish!', 'Publish!', 'I smell a series!')
	return alfa[min(3, max(x.count('good'), 0))]


def well(x):
	goodCount = 0
	for item in x:
		if item == 'good':
			goodCount += 1
	if goodCount > 2:
		return 'I smell a series!'
	elif goodCount > 0:
		return 'Publish!'
	else:
		return 'Fail!'


def well(x):
	a = 0
	for i in x:
		if i.lower() == 'good':
			a += 1
	if a <= 2 and a != 0:
		return 'Publish!'
	elif a > 2:
		return 'I smell a series!'
	else:
		return 'Fail!'


def well(x):
	c = len([i for i in x if i == 'good'])
	if c == 0:
		return 'Fail!'
	elif c < 3:
		return 'Publish!'
	else:
		return 'I smell a series!'


def well(x):
	cnt = x.count('good')
	return 'Fail!' if cnt == 0 else 'Publish!' if cnt < 3 else 'I smell a series!'


def well(x):
	counter = 0
	for idea in x:
		if idea == 'good':
			counter += 1
	if counter == 0:
		return 'Fail!'
	elif counter <= 2:
		return 'Publish!'
	else:
		return 'I smell a series!'


def well(x):
	n = x.count('good')
	return 'Fail!' if n < 1 else 'Publish!' if n < 3 else 'I smell a series!'


def well(x):
	score = 0
	for count in range(len(x)):
		if x[count] == 'good':
			score += 1
		else:
			continue
	if score > 0 and score < 3:
		return 'Publish!'
	elif score > 2:
		return 'I smell a series!'
	else:
		return 'Fail!'


def well(x):
	d = {i: x.count(i) for i in x}
	if not d.get('good'):
		return 'Fail!'
	elif 1 <= d.get('good') <= 2:
		return 'Publish!'
	else:
		return 'I smell a series!'


def well(x):
	y = 'good'
	count = 0
	cw = 0
	while len(x) > cw:
		if x[cw] == y:
			count = count + 1
			cw = cw + 1
		else:
			cw = cw + 1
	if count == 1 or count == 2:
		return 'Publish!'
	elif count > 2:
		return 'I smell a series!'
	else:
		return 'Fail!'


def well(x):
	good_count = 0
	for idea in x:
		if idea == 'good':
			good_count += 1
	if good_count == 0:
		return 'Fail!'
	elif good_count < 3:
		return 'Publish!'
	else:
		return 'I smell a series!'


def well(x):
	c = x.count('good')
	a = ''
	if c == 0:
		a = 'Fail!'
	elif c < 3:
		a = 'Publish!'
	else:
		a = 'I smell a series!'
	return a


def well(x):
	y = x.count('good')
	if y is 0:
		return 'Fail!'
	if y == 1 or y == 2:
		return 'Publish!'
	return 'I smell a series!'


def well(x):
	good_ideas = sum((1 for word in x if word == 'good'))
	if good_ideas > 2:
		return 'I smell a series!'
	elif good_ideas > 0:
		return 'Publish!'
	return 'Fail!'


def well(x):
	count_good = x.count('good')
	if count_good > 0 and count_good <= 2:
		return 'Publish!'
	elif count_good > 2:
		return 'I smell a series!'
	return 'Fail!'


def well(x):
	return ['Fail!', 'Publish!', 'Publish!', 'I smell a series!', 'I smell a series!', 'I smell a series!', 'I smell a series!'].__getitem__(x.count('good'))


def well(x):
	for i in x:
		if x.count('good') >= 3:
			return 'I smell a series!'
		elif 0 < x.count('good') <= 2:
			return 'Publish!'
		elif x.count:
			return 'Fail!'


def well(x):
	goodCounter = 0
	for i in range(len(x)):
		if x[i] == 'good':
			goodCounter += 1
	if goodCounter == 1 or goodCounter == 2:
		return 'Publish!'
	elif goodCounter > 2:
		return 'I smell a series!'
	return 'Fail!'


def well(x):
	if str(x.count('good')) in '12':
		return 'Publish!'
	elif x.count('good') > 2:
		return 'I smell a series!'
	else:
		return 'Fail!'


def well(x):
	y = x.count('good')
	if 2 >= y >= 1:
		return 'Publish!'
	elif y >= 3:
		return 'I smell a series!'
	if y == 0:
		return 'Fail!'


def well(x):
	if not 'good' in x:
		return 'Fail!'
	elif len([i for i in x if i == 'good']) > 2:
		return 'I smell a series!'
	else:
		return 'Publish!'