In this program, we will take a user input as a list and merge all elements of the list in a single entity using a special character with the help of the below-given steps.
Merge all elements in a list:
Steps to solve the program
- Take a list of characters as input.
- Join the characters from the list using join() to merge all elements.
- Use “$” to join the character.
- Print the output.
#Input list
list1 = ["a","b","c","d"]
#Joining and printing output
print("$".join(list1))
Output :
a$b$c$d
Related Articles
Python program to get the difference between two lists.
Python program to reverse each element of the list.
Python program to combine two list elements as a sublist in a list.
Python program to get keys and values from the list of dictionaries.
Python program to get all the unique numbers in the list.
Python program to convert a string into a list.