CHALLENGE: randomize words of a sentence | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

CHALLENGE: randomize words of a sentence

Take a sentence as a input. Randomize all its words separated by'/'. Example: INPUT: I love you, you love me; you know it. OUTPUT: I/you/it./love/know/you,/me;/love./you

17th Jan 2018, 2:09 AM
Sujeet Agrahari
Sujeet Agrahari - avatar
6 Answers
17th Jan 2018, 6:03 AM
Justine Ogaraku
Justine Ogaraku - avatar
+ 11
https://code.sololearn.com/cUFi1qQYEU0Y/?ref=app
17th Jan 2018, 12:10 PM
LukArToDo
LukArToDo - avatar
17th Jan 2018, 5:26 AM
David Ashton
David Ashton - avatar
17th Jan 2018, 3:15 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 6
with Math.random() not perfect randomizer https://code.sololearn.com/ccKBHtn4aTUB/?ref=app
17th Jan 2018, 4:56 AM
abdulazizumarovich
abdulazizumarovich - avatar
+ 2
Thanks to everyone, I am a newbie here, and I'm so glad to be here. Learnt a lot from your codes. This is a simple problems that involves shuffling an array or list. Many of you have used built-in methods for it, that's totally fine. Where ever it comes to shuffling, I never hesitate to use Fisher-Yates algorithm, it's much efficient. I think those built-in methods use it too behind the scene. Here is the code, it's written in javascript though. https://code.sololearn.com/WuMoA5x2JVxl/?ref=app
19th Jan 2018, 9:43 AM
Sujeet Agrahari
Sujeet Agrahari - avatar