[**CHALLENGE**] Input and Output Switch | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

[**CHALLENGE**] Input and Output Switch

Have the user put in an input of at least 5 words and then take every third word and move it to the front of the sentence and output the sentence. Post your codes below and tag them as "input third switch"

23rd Nov 2017, 2:15 AM
Caleb Royer
Caleb Royer - avatar
5 Answers
+ 5
Hey Caleb, is this how you mean?? https://code.sololearn.com/cO8bOIy9tIqg/?ref=app
23rd Nov 2017, 7:23 AM
Justine Ogaraku
Justine Ogaraku - avatar
+ 5
@Caleb thanks ✌
23rd Nov 2017, 3:43 PM
Justine Ogaraku
Justine Ogaraku - avatar
+ 4
@Caleb thanks ✌
23rd Nov 2017, 3:44 PM
Justine Ogaraku
Justine Ogaraku - avatar
+ 1
sen="i am a human" sen1="bread starts with b" def third_switch(s): sp=s.split() sp[0],sp[2]=sp[2],sp[0] print (*sp,sep=" ") print (third_switch (sen ))
23rd Nov 2017, 3:53 AM
sayan chandra
sayan chandra - avatar
+ 1
Yes I did @Justine nice code and @Yash I believe that numbers may work as well.
23rd Nov 2017, 2:53 PM
Caleb Royer
Caleb Royer - avatar