Complete the code to import the Dataset class from PyTorch.
from torch.utils.data import [1]
The Dataset class is imported from torch.utils.data to create custom datasets.
Complete the code to define the __len__ method that returns the dataset size.
def __len__(self): return [1]
The __len__ method should return the number of samples, which is the length of the data list.
Fix the error in the __getitem__ method to return the correct sample.
def __getitem__(self, idx): sample = self.data[[1]] return sample
The index idx should be used directly to access the data at that position.
Fill both blanks to create a dictionary comprehension that maps words to their lengths for words longer than 3 characters.
lengths = {word: [1] for word in words if [2]The dictionary comprehension maps each word to its length using len(word), filtering words longer than 3 characters with len(word) > 3.
Fill all three blanks to create a dictionary comprehension that maps uppercase words to their lengths for words longer than 4 characters.
result = [1]: [2] for word in words if [3]
The comprehension maps the uppercase version of each word to its length, filtering words longer than 4 characters.