The wide mouth frog is particularly interested in the eating habits of other creatures.

He just can't stop asking the creatures he encounters what they like to eat. But then he meet the alligator who just LOVES to eat wide-mouthed frogs!

When he meets the alligator, it then makes a tiny mouth.

Your goal in this kata is to create complete the `mouth_size` method this method take one argument `animal` which corresponds to the animal encountered by frog. If this one is an `alligator` (case insensitive) return `small` otherwise return `wide`.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def mouth_size(animal):
	

Solutions:
def mouth_size(animal):
	return 'small' if animal.lower() == 'alligator' else 'wide'


def mouth_size(animal):
	mouth = {'alligator': 'small'}
	return mouth.get(animal.lower(), 'wide')


import re

def mouth_size(animal):
	return 'small' if re.search('alligator', animal, re.IGNORECASE) else 'wide'


mouth_size = lambda s: 'small' if s.lower() == 'alligator' else 'wide'


mouth_size = lambda a: 'small' if a.lower() == 'alligator' else 'wide'


def mouth_size(s):
	return 'small' if s.lower() == 'alligator' else 'wide'


def mouth_size(animal):
	return 'small' if animal.upper() == 'ALLIGATOR' else 'wide'


mouth_size = lambda animal: ['wide', 'small'][animal.lower() == 'alligator']


mouth_size = lambda animal: 'small' if animal.lower() == 'alligator' else 'wide'


def mouth_size(animal):
	animal = animal.lower()
	return 'sm' + animal[:3] if animal[3:] == 'igator' else 'wide'


def mouth_size(animal):
	if animal.casefold() == 'alligator':
		return 'small'
	else:
		return 'wide'
print(mouth_size('alligator'))


def mouth_size(animal):
	return animal.lower() == 'alligator' and 'small' or 'wide'


def mouth_size(animal):
	return ('wide', 'small')[animal.lower() == 'alligator']


def mouth_size(animal):
	if animal.find('l') == 1 or animal.find('L') == 1:
		return 'small'
	else:
		return 'wide'


def mouth_size(animal):
	if animal.lower() == 'alligator' or animal.lower() is 'alligator!':
		return 'small'
	return 'wide'


mouth_size = lambda x: ('wide', 'small')[x.lower() == 'alligator']


def mouth_size(animal):
	if animal.lower() != 'alligator':
		return 'wide'
	elif animal.lower() == 'alligator':
		return 'small'


def mouth_size(animal):
	return 'small' if animal.title() == 'Alligator' else 'wide'


def mouth_size(animal):
	state = 'wide'
	if animal.lower() == 'alligator':
		state = 'small'
	return state


def mouth_size(animal):
	x = 'alligator'
	if animal.casefold() == x.casefold():
		return 'small'
	else:
		return 'wide'


def mouth_size(animal):
	new_animal = animal.lower()
	if new_animal == 'alligator':
		return 'small'
	return 'wide'


def mouth_size(animal):
	animal = animal.casefold()
	return 'small' if 'alligator' in animal else 'wide'


def mouth_size(ani):
	animal = ani.lower()
	if animal == 'alligator':
		return 'small'
	elif animal == 'toucan':
		return 'wide'
	elif animal == 'ant bear':
		return 'wide'
	else:
		return 'wide'


def mouth_size(animal):
	if str(animal).lower() == 'alligator':
		return 'small'
	return 'wide'


def mouth_size(animal):
	new_animal = ''
	for letters in animal:
		if 65 <= ord(letters) <= 90:
			new_animal += chr(ord(letters) + 32)
		else:
			new_animal += letters
	if new_animal == 'alligator':
		return 'small'
	return 'wide'


import re

def mouth_size(animal):
	pattern = re.match('alligator', animal, re.I)
	if pattern:
		return 'small'
	return 'wide'


def mouth_size(animal):
	x = animal.casefold()
	if x == 'alligator':
		return 'small'
	print(x)
	return 'wide'


def mouth_size(animal):
	animal = animal.lower()
	ergebnis = 'wide'
	if animal == 'alligator':
		ergebnis = 'small'
	return ergebnis


def mouth_size(x):
	x = x.lower()
	x = x.replace('!', '')
	return 'small' if x == 'alligator' else 'wide'


def mouth_size(animal):
	animal = str(animal).lower()
	if animal == 'alligator':
		return 'small'
	else:
		return 'wide'
s = mouth_size('alligator')
print(s)


def mouth_size(animal):
	return 'small' if animal.lower().capitalize() == 'Alligator' else 'wide'


mouth_size = lambda a: ['wide', 'small']['tor' in a.casefold()]


def mouth_size(animal):
	a = animal.lower()
	print(a)
	if a == 'alligator':
		return 'small'
	else:
		return 'wide'


import re

def mouth_size(animal):
	animalnew = animal.lower()
	if animalnew == 'alligator':
		return 'small'
	else:
		return 'wide'


def mouth_size(animal):
	ani = 'alligator'.strip('!')
	return 'small' if animal.lower() == ani else 'wide'


def mouth_size(animal):
	a = len('alligator')
	b = len(animal)
	return 'wide' if b != a else 'small'


def mouth_size(animal):
	return 'wide' if not animal.lower() in 'alligator' else 'small'


def mouth_size(animal):
	print(animal.capitalize())
	if animal.capitalize() == 'Alligator':
		return 'small'
	else:
		return 'wide'


def mouth_size(animal):
	if animal.upper() == 'alligator'.upper():
		return 'small'
	return 'wide'


def mouth_size(animal):
	ret = 'wide'
	if animal.lower() == 'alligator':
		ret = 'small'
	return ret


def mouth_size(animal):
	return 'small' if ''.join([x.lower() for x in animal]) == 'alligator' else 'wide'


mouth_size = lambda n: 'small' if n.casefold() == 'alligator' else 'wide'


def mouth_size(animal):
	if len(animal) < 9:
		return 'wide'
	elif len(animal) > 9:
		return 'wide'
	else:
		return 'small'


def mouth_size(animal):
	mouth = ''
	if animal.casefold() != 'alligator':
		mouth = 'wide'
	else:
		mouth = 'small'
	return mouth


def mouth_size(animal):
	new = animal.lower()
	if 'alligator' in new:
		return 'small'
	elif 'alligator!' in new:
		return 'small'
	else:
		return 'wide'


def mouth_size(animal):
	result = ''
	animal_recase = animal.lower()
	if animal_recase == 'alligator':
		result = 'small'
	else:
		result = 'wide'
	return result


def mouth_size(animal):
	c = animal.lower()
	a = 'small'
	b = 'wide'
	if c == 'alligator':
		return a
	else:
		return b