How do I change labels for a column of data with list comprehension?

I am attempting to mark each dog that has surpassed the age of 100, in human years, as “Dead”, but I don’t know the correct syntax and am therefore rewarded with a syntax error.

I have played around with parentheses and brackets, but to no avail.

Any help is much appreciated and thank you in advance :slight_smile:

human_years = [4, 6, 9, 12, 14, 24, 30]

dog_years = [age * 7 if (age * 7) <= 100 else age = "Dead" for age in human_years]


the else:

else age = "Dead"

not sure why you use assignment? You can simplify specify the value you want appended to the list

So simple! :sweat_smile:

I’m new to Python and was completely overthinking it.

Thank you so much for the response.