Skip to content

Commit

Permalink
Update replacetext.py
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Swastik-Saha authored Oct 3, 2020
1 parent f2727b0 commit 53b283d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions replacetext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 53b283d

Please sign in to comment.