Skip to content
Advertisement

Why does python not provide output in this code?

JavaScript

Here, dataset is a list and s is an integer value index of any object in the list.

Advertisement

Answer

The problem is with this line:

JavaScript

You don’t tell us what sentences is, but it’s apparent it’s not what it needs to be.

For example:

JavaScript

If your sentences was a list of two-tuples the code would work:

JavaScript
Advertisement