There are just some things you can't do on television. In this case, you've just come back from having a "delicious" Barth burger and you're set to give an interview. The Barth burger has made you queezy, and you've forgotten some of the import rules of the "You Can't Do That on Television" set.

If you say any of the following words a large bucket of "water" will be dumped on you:
"water", "wet", "wash"
This is true for any form of those words, like "washing", "watered", etc.

If you say any of the following phrases you will be doused in "slime":
"I don't know", "slime"

If you say both in one sentence, a combination of water and slime, "sludge", will be dumped on you.

Write a function, bucketOf(str), that takes a string and determines what will be dumped on your head. If you haven't said anything you shouldn't have, the bucket should be filled with "air". The words should be tested regardless of case.

Examples:


Check out my other 80's Kids Katas:


80's Kids #1: How Many Licks Does It Take
80's Kids #2: Help Alf Find His Spaceship
80's Kids #3: Punky Brewster's Socks
80's Kids #4: Legends of the Hidden Temple
80's Kids #5: You Can't Do That on Television
80's Kids #6: Rock 'Em, Sock 'Em Robots
80's Kids #7: She's a Small Wonder
80's Kids #8: The Secret World of Alex Mack
80's Kids #9: Down in Fraggle Rock 
80's Kids #10: Captain Planet

Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code:
def bucket_of(said):
	

Solutions:
import re
WATER_PATTERN = re.compile('water|wet|wash', re.I)
SLIME_PATTERN = re.compile("\\bI don't know\\b|slime", re.I)

def bucket_of(said):
	water = WATER_PATTERN.search(said)
	slime = SLIME_PATTERN.search(said)
	if water:
		return 'sludge' if slime else 'water'
	return 'slime' if slime else 'air'


def bucket_of(said):
	said = said.lower()
	forgiven_words = lambda *words: any((w in said for w in words))
	water = forgiven_words('water', 'wet', 'wash')
	slime = forgiven_words("i don't know", 'slime')
	return ['air', 'water', 'slime', 'sludge'][2 * slime + water]


import re
water = re.compile('water|wet|wash', flags=re.I)
slime = re.compile("slime|i don't know", flags=re.I)

def bucket_of(said):
	w = water.search(said)
	s = slime.search(said)
	if w and s:
		return 'sludge'
	elif w:
		return 'water'
	elif s:
		return 'slime'
	else:
		return 'air'


def bucket_of(said):
	(s, l) = (said.lower(), ['air', 'water', 'slime', 'sludge'])
	return l[any(['wet' in s, 'water' in s, 'wash' in s]) + any(['know' in s, 'slime' in s]) * 2]


import re

def bucket_of(said):
	pattern1 = 'water|wet|wash'
	pattern2 = "slime|i don't know"
	result1 = re.search(pattern1, said, re.I)
	result2 = re.search(pattern2, said, re.I)
	if result1 and result2:
		return 'sludge'
	elif result1:
		return 'water'
	elif result2:
		return 'slime'
	else:
		return 'air'


def bucket_of(said):
	teststring = said.lower()
	result = []
	water = ['water', 'wet', 'wash']
	slime = ["i don't know", 'slime']
	for i in range(len(water)):
		if water[i] in teststring:
			result.append('water')
		else:
			continue
	for i in range(len(slime)):
		if slime[i] in teststring:
			result.append('slime')
		else:
			continue
	if 'water' in result and 'slime' in result:
		return 'sludge'
	elif 'water' in result:
		return 'water'
	elif 'slime' in result:
		return 'slime'
	else:
		return 'air'


import re
bucket_of = lambda said: {0: 'air', 1: 'water', 2: 'slime', 3: 'sludge'}[bool(re.search('(?i)(water|wet|wash)', said)) + bool(re.search("(?i)(I don't know|slime)", said)) * 2]


def bucket_of(said):
	(water_list, slime_list) = (['water', 'wet', 'wash'], ["i don't know", 'slime'])
	s = said.lower()
	water = any((w in s for w in water_list))
	slime = any((sl in s for sl in slime_list))
	return 'sludge' if water and slime else 'water' if water else 'slime' if slime else 'air'


bucket_of = lambda s: ['air', 'water', 'slime', 'sludge'][(lambda x: ('wet' in x or 'water' in x or 'wash' in x) + ("i don't know" in x or 'slime' in x) * 2)(s.lower())]


def bucket_of(said):
	s = said.lower()
	if 'slime' in s and 'water' not in s:
		return 'slime'
	elif "i don't know" in s:
		if 'water' in s:
			return 'sludge'
		return 'slime'
	elif 'water' in s or 'wet' in s or 'wash' in s:
		if 'slime' in s:
			return 'sludge'
		if "i don't know" in s:
			return 'slime'
		return 'water'
	return 'air'