+ 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"
6 Antworten
+ 5
Hey Caleb, is this how you mean??
https://code.sololearn.com/cO8bOIy9tIqg/?ref=app
+ 5
@Caleb thanks ✌
+ 4
@Caleb thanks ✌
+ 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 ))
+ 1
Yes I did @Justine nice code and @Yash I believe that numbers may work as well.