Post

PythonPython

c
chris bons

Posted on 5th March 2024|21 views

0
votes

Python Array To String

How to convert array to string in python?

Answers
P
Harish Harsh

Posted on 5th March 2024

Let us see a program for converting an array to string

# Function that convert  

def listToString(s): 

#let us initialize an empty string first

   str = "" 

# next traverse within the string  

    for ele in s: 

        str += ele  

 # returning the string  

    return str 

 # Driver code  

s1 = [‘mind’,’majix’]

print(listToString(s1))

Output:

mindmajix

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos