Your friend sent you a message, however his keyboard is broken and types a # instead of a space. Replace all of the # charact | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Your friend sent you a message, however his keyboard is broken and types a # instead of a space. Replace all of the # charact

Help me out

13th Jul 2022, 2:44 AM
Adeleke Abdul Rahmon
7 Answers
+ 4
Adeleke Abdul Rahmon , replace needs 2 arguments, separated by a comma. it does not work inplace, but returns the new string according the arguments: ... msg.replace("what_to_replace", "replacement")
13th Jul 2022, 6:41 AM
Lothar
Lothar - avatar
+ 1
msg = input() print(msg.replace("#"," "))
14th Jul 2022, 1:30 PM
Janne
Janne - avatar
0
try using replace() or split the string at the pound symbols and joins the resulting list with spaces
13th Jul 2022, 3:03 AM
Slick
Slick - avatar
0
msg = input() msg= msg.replace("#"",") print (msg)
13th Jul 2022, 3:05 AM
Adeleke Abdul Rahmon
0
msg = input() msg= msg.replace("#"",") print (msg) Help me check it
13th Jul 2022, 3:06 AM
Adeleke Abdul Rahmon
0
msg = input() msg = msg.replace("#","") print (msg
13th Jul 2022, 9:27 AM
Adeleke Abdul Rahmon
0
Correct have gotten it
13th Jul 2022, 10:53 AM
Adeleke Abdul Rahmon