Complete the code to show the first 3 rows of the DataFrame.
df.[1](3)
The head() method shows the first rows of a DataFrame. Here, head(3) shows the first 3 rows.
Complete the code to display the last 5 rows of the DataFrame.
df.[1](5)
The tail() method shows the last rows of a DataFrame. Here, tail(5) shows the last 5 rows.
Fix the error in the code to correctly show the first 4 rows of the DataFrame.
df.[1](4)
To show the first 4 rows, use head(4). Using tail(4) shows the last 4 rows, which is incorrect here.
Fill both blanks to create a dictionary of word lengths for words longer than 3 characters.
{word: [1] for word in words if len(word) [2] 3}The dictionary comprehension maps each word to its length using len(word). The condition len(word) > 3 filters words longer than 3 characters.
Fill all three blanks to create a dictionary with uppercase words as keys, their lengths as values, for words longer than 4 characters.
{ [1]: [2] for word in words if len(word) [3] 4 }The dictionary keys are uppercase words using word.upper(). The values are word lengths with len(word). The condition len(word) > 4 filters words longer than 4 characters.