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

I tried and it worked but I'm not sure what exactly this task want me to right so that I can pass the task??!!

task 3 of 3

age.py
days = / 7
weeks = 5

1 Answer

David Evans
David Evans
10,490 Points

The first task has you create a variable named years and wants you to set the value of it to your actual current age.

Mine for example:

years = 31

Make sure you don't use quotations as that would make it a string and not an integer.

The second task wants you to create a new variable called days and set the value of it to your years variable multiplied by 365.

days = years * 365

You should now have the following:

years = 31
days = years * 365

The third task wants you to make a new variable named weeks and assign it the value of your days variable divided by 7.

weeks = days / 7

Overall your code should be

years = 31
days = years * 365
weeks = days / 7