From 8eaccbc18a898a7e7c8d6d14a2fac3a403952b83 Mon Sep 17 00:00:00 2001 From: Athul Date: Thu, 18 Oct 2018 22:18:39 +0530 Subject: [PATCH] Add replacetext file --- replacetext.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 replacetext.py 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