Exemple #1
0
def make_ing_form(verb):
    if verb.endswith('ie'):
        return verb[:-2] + 'ying'
    elif verb.endswith('e') and (verb[-2].endswith('e') or len(verb) == 2):
        return verb + 'ing'
    elif verb.endswith('e'):
        return verb[:-1] + 'ing'
    elif not is_vowel(verb[-1]) and is_vowel(verb[-2]) and not is_vowel(verb[-3]):
        return verb + verb[-1] + 'ing'
    else:
        return verb + 'ing'
Exemple #2
0
def make_ing_form(verb):
    if verb.endswith('ie'):
        return verb[:-2] + 'ying'
    elif verb.endswith('e') and (verb[-2].endswith('e') or len(verb) == 2):
        return verb + 'ing'
    elif verb.endswith('e'):
        return verb[:-1] + 'ing'
    elif not is_vowel(verb[-1]) and is_vowel(verb[-2]) and not is_vowel(verb[-3]):
        return verb + verb[-1] + 'ing'
    else:
        return verb + 'ing'
Exemple #3
0
def translate(string):
    results = []
    for word in string.split():
        result = ''
        for char in word:
            if not is_vowel(char):
                result += char + 'o' + char
            else:
                result += char
        results.append(result)
    return ' '.join(results)
Exemple #4
0
def translate(string):
    results = []
    for word in string.split():
        result = ''
        for char in word:
            if not is_vowel(char):
                result += char + 'o' + char
            else:
                result += char
        results.append(result)
    return ' '.join(results)
Exemple #5
0
def translate(string):

    results = []
    for word in string.split():
        result = ""
        for letter in word:
            if is_vowel(letter):
                result += letter
            else:
                result += letter + "o" + letter
        results.append(result)

    return ' '.join(results)
Exemple #6
0
def translate(s):
    return ''.join(c + 'o' + c if not is_vowel(c) else c for c in s)
Exemple #7
0
#!/usr/bin/env python

"""
Write a function that takes a character (i.e. a string of length 1) and returns True if it is a vowel, False otherwise.
"""


def is_vowel(char):
    vowels = ('a', 'e', 'i', 'o', 'u')
    if char not in vowels:
        return False
    return True


if __name__ == "__main__":
    print is_vowel(1)
    print is_vowel('a')
    print is_vowel('b')

###########ex5
#!/usr/bin/env python

"""
Write a function translate() that will translate a text into "rovarspraket" (Swedish for "robber's language").
That is, double every consonant and place an occurrence of "o" in between.
For example, translate("this is fun") should return the string "tothohisos isos fofunon".
"""

from ex4 import is_vowel