Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions replacetext.py
Original file line number Diff line number Diff line change
@@ -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)