Calculating artist ages


after writing the below code to calculate artist ages, i t keeps returning an error result for ages and final_ages.

i have gone through the code over and over to see where i got it all wrong, but i couldn’t figure out any.
kindly put me through this

ages =
for row in moma:
birth = row[3]
date = row[6]
if type(birth) == int:
age = date - birth
age = 0

final_ages =
for age in ages:
if age > 20:
final_age = age
final_age = “Unknown”

thank you for your time.

Hi @AjeleOluwaseunOlawal

I tried your code in the Dataquest system, and it works perfectly without any error. Please try again. It will work.

Take a look at this article.

1 Like