Split and join a string using “-“

In this program, we will take a string as input and split and join a string using “-“.

Steps to solve the program
  1. Take a string as input.
  2. Split the string using split().
  3. Join the splitter string using join().
  4. Print the ouput.
				
					#Input string
str1 = "Sqatools is best"
list1 = str1.split(" ")

#Printing output
print("-".join(list1))
				
			

Output :

				
					Sqatools-is-best
				
			

uppercase half string

find permutations of a given string

Leave a Comment