Join elements with a special character
Write a Python program to merge all elements of a list into one string using a special character.
["sqa", "tools", 2026, "python"], separator "#"
sqa#tools#2026#python
Approach
- Convert each item to str and join with the separator.
Solution
items = ["sqa", "tools", 2026, "python"]print("#".join(str(x) for x in items))sqa#tools#2026#python
Line by line
join only accepts strings, so the number is converted first.
Learn the concept
New to this topic? Read the lesson, then come back.