human
Program to replace every space in a string with hyphen | Python program for the above approach.
Split by space and converting String to list and.
joining the list and storing in string.
returning thee string.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to program to replace every space in a string with hyphen and the other steps required.
 def printHyphen ( string ) :
	lis = list ( string . split ( " ▁ " ) )
	string = ' - ' . join ( lis )
	return string
string = " Text ▁ contains ▁ malayalam ▁ and ▁ level ▁ words "
print ( printHyphen ( string ) )