Write a Python program to concatenate all elements in a list into a string and return it


Introduction

Write a Python program to concatenate all elements in a list into a string and return it. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. def concatenate_list_data(list):
  2. result= ''
  3. for element in list:
  4. result += str(element)
  5. return result
  6.  
  7. print(concatenate_list_data([2, 10, 22, 21]))
  8.  

Result

python language techstudy.org

     





Related Topics




Popular Posts