If you like Taco Bell, you will be familiar with their signature doritos locos taco. They're very good.


Why can't everything be a taco? We're going to attempt that here, turning every word we find into the taco bell recipe with each ingredient.


We want to input a word as a string, and return a list representing that word as a taco.

***Key***

all vowels (except 'y') = beef

t = tomato

l = lettuce

c = cheese

g = guacamole

s = salsa

  
***NOTE***    
We do not care about case here. 'S' is therefore equivalent to 's' in our taco.
  
Ignore all other letters; we don't want our taco uneccesarily clustered or else it will be too difficult to eat.

Note that no matter what ingredients are passed, our taco will always have a shell.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def tacofy(word):
	

Solutions:
import re
TACODICT = {'t': 'tomato', 'l': 'lettuce', 'c': 'cheese', 'g': 'guacamole', 's': 'salsa'}

def tacofy(word):
	return ['shell'] + [TACODICT.get(c, 'beef') for c in re.sub('[^aeioutlcgs]+', '', word.lower())] + ['shell']


def tacofy(word):
	tacos = {'a': 'beef', 'e': 'beef', 'i': 'beef', 'o': 'beef', 'u': 'beef', 't': 'tomato', 'l': 'lettuce', 'c': 'cheese', 'g': 'guacamole', 's': 'salsa'}
	return ['shell'] + [tacos[c.lower()] for c in word if c.lower() in tacos] + ['shell']


def tacofy(word):
	d = {'t': 'tomato', 'l': 'lettuce', 'c': 'cheese', 'g': 'guacamole', 's': 'salsa'}
	return ['shell'] + [d.get(i, 'beef') for i in word.lower() if i in 'aeioutlcgs'] + ['shell']


DCT = {'t': 'tomato', 'l': 'lettuce', 'c': 'cheese', 'g': 'guacamole', 's': 'salsa'}
DCT.update({c: 'beef' for c in 'aeiuo'})

def tacofy(word):
	return ['shell'] + [DCT[c] for c in word.lower() if c in DCT] + ['shell']


dict = {'a': 'beef', 'e': 'beef', 'i': 'beef', 'o': 'beef', 'u': 'beef', 't': 'tomato', 'l': 'lettuce', 'c': 'cheese', 'g': 'guacamole', 's': 'salsa'}

def tacofy(word):
	outlist = ['shell']
	for c in word.lower():
		if c in dict:
			outlist.append(dict.get(c))
	outlist.append('shell')
	return outlist


def tacofy(word):
	word = [i if i.lower() in 'tlcgs' else 'a' if i.lower() in 'aeiou' else '' for i in word]
	d = {'a': 'beef', 't': 'tomato', 'l': 'lettuce', 'c': 'cheese', 'g': 'guacamole', 's': 'salsa'}
	return ['shell'] + [d[i.lower()] for i in word if i] + ['shell']


ing = {'t': 'tomato', 'l': 'lettuce', 'c': 'cheese', 'g': 'guacamole', 's': 'salsa', 'a': 'beef', '|': 'shell'}

def tacofy(word):
	return [ing[c] for c in '|{}|'.format(''.join((c if c in 'tlcgs' else 'a' if c in 'aeiou' else '' for c in word.lower())))]


t = dict(zip('.tlcgsaeiou', 'shell tomato lettuce cheese guacamole salsa'.split() + ['beef'] * 5))
tacofy = lambda s: [t[c] for c in '.%s.' % s.lower() if c in t]