Please tell me how to put space between strings? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please tell me how to put space between strings?

I'd like to change 'Thisstringswithspace' to 'This strings with space' So, what module should I use to make a function that returns 'This strings with space' from 'Thisstringswithspace'? def a(): b = #something code here print(b) input a('Thisstringswithspace') output 'This strings with space'

14th Feb 2019, 12:45 PM
Shumpei Sori
Shumpei Sori - avatar
6 Answers
+ 1
Shumpei Sori ik codewars. Did you choose the difficulty of 1kyu or 2? They are too hard. Try taking those with 5,6,7 and 8
14th Feb 2019, 3:40 PM
Seniru
Seniru - avatar
+ 4
I cant get you. Can you make it more clearer. At this time I can suggest only to press space between letters 😅 https://www.sololearn.com/discuss/1316935/?ref=app
14th Feb 2019, 12:48 PM
Seniru
Seniru - avatar
+ 4
I don't recognize any pattern. Do you just want to insert spaces at random positions?
14th Feb 2019, 12:54 PM
Anna
Anna - avatar
+ 4
This is a lot harder than you imagine because you'll need some kind of function that recognizes where one word ends and the next one begins. You could include a dictionary with all words of the English language.
14th Feb 2019, 1:14 PM
Anna
Anna - avatar
+ 1
As Anna said it is harder than you imagined. If you can't store a lost of words (and probably don't) use a web scraper or API to fetch a list of words and try to find all possible words in the string. But why you need to do this kind of thing?
14th Feb 2019, 1:43 PM
Seniru
Seniru - avatar
+ 1
I didn’t imagin it is difficult than I imagining until you two answerd me. Thank you. I got this question at ‘codewar’(on web), and I searched on web to solve tha question. But I couldnt find way to do.
14th Feb 2019, 2:02 PM
Shumpei Sori
Shumpei Sori - avatar