From 53b283d49d79b458cc278ffaace80b5314383bba Mon Sep 17 00:00:00 2001 From: Swastik Saha <65535891+Swastik-Saha@users.noreply.github.com> Date: Sat, 3 Oct 2020 12:34:12 +0530 Subject: [PATCH] Update replacetext.py Made the function replacetext more simpler and pythonic. Now it will do the same work in single step rather than doing it in two steps. --- replacetext.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/replacetext.py b/replacetext.py index 08e89fdd81d..4901df276be 100644 --- a/replacetext.py +++ b/replacetext.py @@ -2,8 +2,7 @@ # -*- 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) + string = string.replace(" ", "-") return string