Gordon Ramsay shouts. He shouts and swears. There may be something wrong with him.

Anyway, you will be given a string of four words. Your job is to turn them in to Gordon language. 

Rules:

Obviously the words should be Caps,
Every word should end with '!!!!',
Any letter 'a' or 'A' should become '@',
Any other vowel should become '*'.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures

Starter code: def gordon(a):
	

Solutions:
def gordon(a):
	return '!!!! '.join(a.upper().split()).translate(str.maketrans('AEIOU', '@****')) + '!!!!'


def gordon(s):
	return ' '.join((x + '!!!!' for x in s.upper().translate(str.maketrans('AIUEO', '@****')).split()))


def gordon(a):
	return ' '.join((word.upper().translate(str.maketrans('AEIOU', '@****')) + '!!!!' for word in a.split()))


from functools import partial
from re import compile
REGEX1 = partial(compile('(?<=\\w)(?=\\b)').sub, '!!!!')
trans = str.maketrans('AEIOU', '@****')

def gordon(a):
	return REGEX1(a.upper()).translate(trans)


def gordon(s):
	fmt = '{}!!!!'.format
	table = str.maketrans('AEIOU', '@****')
	return ' '.join((fmt(a.translate(table)) for a in s.upper().split()))


def gordon(a):
	a = a.upper()
	a = a.replace(' ', '!!!! ')
	a = a.replace('A', '@')
	vowels = ['E', 'I', 'O', 'U']
	for each in vowels:
		a = a.replace(each, '*')
	return a + '!!!!'


def gordon(a):
	(out, vowels) = ('', 'eiou')
	for i in a:
		if i == 'a':
			out += '@'
		elif i in vowels:
			out += '*'
		elif i == ' ':
			out += '!!!! '
		else:
			out += str(i).upper()
	return '%s!!!!' % out


import re

def gordon(a):
	return re.sub('[EIOU]', '*', ' '.join((word.upper() + '!!!!' for word in a.split())).replace('A', '@'))