Python: Concatenate all elements in a list into a string and return it
Python Basic: Exercise-27 with Solution
Write a Python program to concatenate all elements in a list into a string and return it.
Sample Solution:-
def concatenate_list_data(list):
result= ''
for element in list:
result += str(element)
return result
print(concatenate_list_data([31, 65,512, 2]))
========== RESTART: F:/Python_APSC/py-ex-basic-27.py ===========
31655122
>>>
沒有留言:
張貼留言