Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (2015) Python Data Types Age Calculation

this is rather annoying. Ic ant move on wihtout solving this task correctly..even if i rerun the lessons, still not gett

there should a way to know the answer and to move along ...where is it?

years = 39
days = 'years' x 365

2 Answers

Keenan Johnson
Keenan Johnson
13,841 Points

Hi Michelle,

It looks like you're trying to multiply the number of years by 365 days to get the total number of days.

This is how you would do it:

years = 39
days = years * 365

The multiplication operator in Python is * instead of x. You also don't want to include the single quotes around the years variable as that is actually indicating that it's a string instead of a variable that has an assigned value. Hope this helps!

Some additional documentation on Math operators in Python: https://www.tutorialspoint.com/python/python_basic_operators.htm

jason chan
jason chan
31,009 Points


First things first we are going try to break this down

Pretend variables are stored values that you can manipulate.

# how old are you in years
years = 1
#how many days are there in a year
days = years * 365
#how many days are in a week?
weeks = days / 7

Concepts to review are defining variables and math operators.