Preview:
string=input('enter string:')
char=input('enter character to replace space:')
modify_String=string.replace(' ',char)
print('After Replacing space with',char,'string will be',modify_String)

(OR)

string=input('enter string:')
char=input('enter character to replace space:')
concate=''
for i in string:
    if i==' ':
        i=char
    concate+=i
print('After Replacing space with',char,'string will be',concate)
    
(OR)

string=input('enter string:')
char=input('enter character to replace space:')
print('After Replacing space with',char,'string will be',char.join(string.split()))


downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter