Answer to Question #175077 in Python for Alok S

Question #175077

string A is "Tea is good for you", k is 3 then output should be "is good."

Here words "Tea", "for", "you" length is equal to 3, so these words are removed from string.


1
Expert's answer
2021-03-24T14:32:12-0400
strin='Tea is good for you'
newStr=strin.split(' ')
new2=newStr[1]
new3=newStr[2]
joined=new2+' '+new3
k=input('enter the vaue of k= 3 \n')
if(int(k)==3):
    print(joined)
    if(int(k)==3):
        text = strin.replace('is good', "\b")
        print("\nNew String without \"" + joined + "\":")
        print(text)
    else:
        print("\n\"" + joined + "\" is not found in the string!")

Output:


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
25.03.21, 07:37

Dear Alok S, Questions in this section are answered for free. We can't fulfill them all and there is no guarantee of answering certain question but we are doing our best. And if answer is published it means it was attentively checked by experts. You can try it yourself by publishing your question. Although if you have serious assignment that requires large amount of work and hence cannot be done for free you can submit it as assignment and our experts will surely assist you.

Alok S
25.03.21, 05:58

Its not passing the cod

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS