31. Problem to merge all elements using a special character

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
  1. Take a list of characters as input.
  2. Join the characters from the list using join() to merge all elements.
  3. Use “$” to join the character.
  4. Print the output.
				
					#Input list
list1 = ["a","b","c","d"]

#Joining and printing output
print("$".join(list1))
				
			

Output :

				
					a$b$c$d
				
			

Related Articles

Find the second smallest number from the list

Get the difference between two lists

Leave a Comment