Python Practice › String Programs › Program 90
Join words with hyphens
Write a Python program to split a string and join it with “-“.
Input
"Sqatools is best"
Output
Sqatools-is-best
Approach
"-".join(text.split()).
Solution
print("-".join("Sqatools is best".split()))Output
Sqatools-is-best
Learn the concept
New to this topic? Read the lesson, then come back.