In this program, we will take a string as input and split and join a string using “-“.
Steps to solve the program
- Take a string as input.
- Split the string using split().
- Join the splitter string using join().
- Print the ouput.
#Input string
str1 = "Sqatools is best"
list1 = str1.split(" ")
#Printing output
print("-".join(list1))
Output :
Sqatools-is-best