MCPcopy Create free account
hub / github.com/geekcomputers/Python / pig_latin_sentence

Function pig_latin_sentence

text_to_pig_latin.py:22–35  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

20
21
22def pig_latin_sentence(text):
23 words = text.split()
24 pig_latin_words = []
25
26 for word in words:
27 # Preserve capitalization
28 if word.isupper():
29 pig_latin_words.append(pig_latin_word(word).upper())
30 elif word.istitle():
31 pig_latin_words.append(pig_latin_word(word).title())
32 else:
33 pig_latin_words.append(pig_latin_word(word))
34
35 return " ".join(pig_latin_words)
36
37
38user_input = input("Enter some English text: ")

Callers 1

Calls 2

pig_latin_wordFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected