Examples :
Input: [’geeks’,’ for’, ’geeks’] Output: geeks for geeks Input: [’Python’,’ Language’] Output: Python Language
Approach # 1: Python string translate ()
The string translate () method returns a string that maps each character to the corresponding character in the translation table. A limitation of this method is that it does not work for Python 3 and later.
|
Exit:
geeks for geeks
Approach # 2: join ()
The join () method is a string method and returns a string in which the elements of the sequence have been concatenated with the str separator. In this approach, space is the delimiter.
|
Exit:
geeks for geeks