diff --git a/replacetext.py b/replacetext.py new file mode 100644 index 00000000000..00702bcbb34 --- /dev/null +++ b/replacetext.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +#program to replace all the spaces in an entered string with a hyphen"-" +def replacetext(string): + string=string.split(" ") + string="-".join(string) + return string +S=input("Enter a text to replace all its spaces with hyphens: ") +N=replacetext(S) +print("The changed text is: ",N) \ No newline at end of file