How to skip last two words in sentence? My input string is: Hi there. My name is Kalp. This is my lucky day. I like coding so much. This is it. Expected output is: Hi there. name My is Kalp. my is This lucky day. coding like I so much. This is it.
it means [start:end:step] means starting from reverse position to full length as in end we have not specified so it will take whole string ,and taking step of 1 from reverse i.e last.
Str= input()
L=[]
For i in Str.split():
L.append(str[i][::-1])
Print("".join(L))
Very useful for my practical exam 👌
Glad to hear that
Hello! Thank you so much for your help! I've been searching for this explanation
Glad it was helpful!
Sir can we use print formatting ?
Str= input()
A = str.split()
Print ( reversed(A))
word = "hello world"
word = word.split(" ")
word = word[::-1]
print(word)
word = "hello world"
word = word.split(" ")
word = word[-1::-1]
print(word)
thanku i just got out from an interview yesterday over the same question
Explain without using inbuilt functions
How to skip last two words in sentence?
My input string is: Hi there. My name is Kalp. This is my lucky day. I like coding so much. This is it.
Expected output is: Hi there. name My is Kalp. my is This lucky day. coding like I so much. This is it.
sdet should be printed as ted ..?
Thanks sir
Welcome
please explain without in built functions
Very helpful!
thanks
why you didn't use words.reverse() ?
if we do that we will get " ," after each string which is not a part of our answer :-)
thank you so much how to do in recursive function
*What does [-1 : : -1] means please explain...*
it means [start:end:step] means starting from reverse position to full length as in end we have not specified so it will take whole string ,and taking step of 1 from reverse i.e last.
Thankssss
Welcome
Nice.
Thanks
Tq bro
Thanks