Skip to content

Commit a7ef040

Browse files
committed
created piglatin.py
1 parent d33ec92 commit a7ef040

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

beginner/lesson7/piglatin.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'''
2+
Write a function translate that translates a list of words to piglatin
3+
ex) input = ['hello', 'world']
4+
output = ['ellohay', 'orldway']
5+
6+
remember, you can concactenate strings using +
7+
ex) 'hello' + ' ' + 'world' = 'hello world'
8+
'''
9+
10+
def translate( ):
11+
# Your code here
12+
13+
phrase = (input("Enter a phrase -> ")).split() # takes a string as input and splits it into a list of strings; ex: hello world becomes ['hello', 'world']
14+
piglatin = translate(phrase) # write the function translate
15+
print(' '.join(piglatin)) # takes a list of strings and make them into one string with a space between each item; ex: ['hello', 'world'] becomes 'hello world'

0 commit comments

Comments
 (0)