"""
MASTER YODA: Given a sentence, return a sentence with the words reversed¶
master_yoda('I am home') --> 'home am I'
master_yoda('We are ready') --> 'ready are We'

Note: The .join() method may be useful here. The .join() method allows you to join together strings in a list with some connector string. For example, some uses of the .join() method:

>>> "--".join(['a','b','c'])
>>> 'a--b--c'

This means if you had a list of words you wanted to turn back into a sentence, you could just join them with a single space string:

>>> " ".join(['Hello','world'])
>>> "Hello world"


In [ ]:
# Check
master_yoda('I am home')
In [ ]:
# Check
master_yoda('We are ready')
"""
def master_yoda(text):
    d=list(text.split()) #text.split()-> split each word of String, and change that will be to list
    newtest=d[2],d[1],d[0]#change the order of word in list
    str2=' '.join(newtest)#change the list back to string
    return str2

print (master_yoda('I am home'))
print (master_yoda('We are ready'))

#version2 take any number of words in one sentensence
def master_yoda(text):
    num=len(text)
    d=list(text.split()) #text.split()-> split each word of String, and change that will be to list
    newtest=d[::-1]
    #newtest=d[2],d[1],d[0]#change the order of word in list
    str2=' '.join(newtest)#change the list back to string
    return str2

print(master_yoda('This is a planet earth'))