Trying to use if as main part of conditional but i don't know why this is not working

https://app.dataquest.io/m/331/python-data-analysis-basics/3/converting-ages-to-decades
dataquest solution::
decades =

for age in final_ages:
    if age == "Unknown":
        decade = age
    else:
        decade = str(age)
        decade = decade[:-1]
        decade = decade + "0s"
    decades.append(decade) 

my solution::
decades=
for age in final_ages:
if age!=‘Unknow’:
age=str(age)
decade=age
decade=decade[:-1]
decade=decade+‘0s’
#ecades.append(decade)
elif age==‘Unknow’:
decade=age
decades.append(decade)

1 Like

Hi @shashankskb18700: Please format all your code properly. Also I think you mispelt unknown.

3 Likes