Skip to content
Advertisement

Items not being appended properly

I was working on the following code which will take input the scrap which has a few phrases as:

JavaScript

Now I want the phrases in scrap which have used the words in prog_list to be appended to TRUE_PROG :

JavaScript

I wrote a simple code having loops in it, but it produces an output that I didn’t expect:

PROGRAM CODE:

JavaScript

If you uncomment #print("ni=",i,"due to t=",t) You’ll find that some phrases that didn’t even have those words were also appended. It gives me this:

JavaScript

and so on. Except the first one, even though the rest don’t have the word, “program”, they still were added. Any correction will be highly valued. Thanks!

Advertisement

Answer

JavaScript

Output:

JavaScript
Advertisement