Complete the code to create a new feature that is the square of the 'age' column.
df['age_squared'] = df['age'] [1] 2
Using ** raises the 'age' values to the power of 2, creating the squared feature.
Complete the code to filter rows where the new feature 'age_squared' is greater than 1000.
filtered_df = df[df['age_squared'] [1] 1000]
The operator > selects rows where 'age_squared' is greater than 1000.
Fix the error in the code to create a feature that is the ratio of 'income' to 'age'.
df['income_per_age'] = df['income'] [1] df['age']
The ratio means dividing income by age, so use the division operator /.
Fill both blanks to create a dictionary of word lengths for words longer than 4 characters.
lengths = {word: [1] for word in words if len(word) [2] 4}The dictionary stores the length of each word, so use len(word). We want words longer than 4, so use >.
Fill all three blanks to create a dictionary of uppercase words and their lengths for words longer than 3 characters.
result = { [1]: [2] for w in words if len(w) [3] 3 }w.lower() for keys instead of uppercase.The keys are uppercase words (w.upper()), values are lengths (len(w)), and filter words longer than 3 (>).