LIMITED TIME OFFER: 50% OFF OF PREMIUM WITH OUR ANNUAL PLAN (THAT'S $294 IN SAVINGS).
GET OFFER

Python Data Analysis #3

Screen Link: <!-- Learn data science with Python and R projects>

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

final_ages =
for a in ages:
if age > 20:
final_age = age
else:
final_age = “Unknown”
final_ages.append(final_age)

Value of ages is not what we expected.
more…

What is wrong here as I don’t see any difference with the suggested solution

Hi @2rinzin1,

The issue is in this row:

for a in ages:

which should be:

for age in ages:

Please next time refer to these guidelines for asking technical questions in the Community.

Thank you
Thank you I checked back and followed with the suggestion
for age in ages:

Gives error message
Value of ages is not what we expected.
more…

I suspect that you have some issue with the code indentation. Can you please send your code put in backticks, according to the guidelines I’ve sent you earlier? Thank you!