Fungsi Berguna dalam Python
# Python code to convert string to list
def Convert(string):
li = list(string.split(" "))
return li
# Driver code
'''
str1 = "Geeks for Geeks"
print(Convert(str1))
'''
def listToString(s):
# initialize an empty string
str1 = ""
# traverse in the string
for ele in s:
str1 += ele +' '
# return string
return str1
'''
# Driver code
s = ['Geeks', 'for', 'Geeks']
print(listToString(s))
'''
Mouad En-naciry