programming-examples/python/Class/Python program to reverse a string word by word.py

6 lines
160 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
class py_solution:
def reverse_words(self, s):
return ' '.join(reversed(s.split()))
print(py_solution().reverse_words('hello .py'))