def aa(string): if not string: return False a=string.split() return ' '.join(a[::-1]) print(aa('I am a engineer.'))