It is simple and straight forward and it can be achieved using 2 methods : replace and split with join
Method 1 : replacestrname='python is simple'
print(strname.replace(' ','-'))
Method 2 : split with joinstrname='python is simple'
print('-'.join(strname.split()))
0 Comments