Hello,
Right now I am doing the Python Data Analysis Basics and I am on page 3/11
.
So in order to access the first number of the age (we want to make it a decade) This is the answer:
decades=
if row == 'Unknown':
decade = row
else:
decade = str(row)
decade = decade[0:-1] + '0s'
decades.append(decade)
However, I wanted to slice it with decade = decade[0] + "0s"
. Why am I unable to do it that way since I’m just interested in the first character of the string?
I don’t know if there’s something wrong with my logic or it’s just something from the platform that requires the first way.