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 trialCarole Cox
429 PointsShould the formula in the challenge be weeks = days /52 ?
The problem may be incorrect...just sayin...:-)
1 Answer
Chris Freeman
Treehouse Moderator 68,454 PointsThe total weeks would be either the total days / 7: (years * 365) / 7
,
or be the number of years * "weeks per year". While these would be close, "years * 52
" would be an integer number of weeks, while dividing the total days by 7 would yield a more accurate floating point result.
>>> years = 32
>>> days = 365 * years
>>> weeks_from_days = days / 7
>>> weeks_from_years = years * 52
>>> weeks_from_years
1664
>>> weeks_from_days
1668.5714285714287
Carole Cox
429 PointsCarole Cox
429 PointsThank you! A nice expanded explanation but I think that Treehouse set the problem up wrong or worded it wrong. In real time Weeks is not days /7. In other words. My age =61 ; days =61 *365 =22,265. then Weeks would be days/52 not 7. in my case 428. Oh my! Not a big deal..it just "looks wrong". But thank you , your answer is helpful in other ways!!!
Chris Freeman
Treehouse Moderator 68,454 PointsChris Freeman
Treehouse Moderator 68,454 PointsHey Carole, I think your math has an error.
Using "unit management" we can check our units. Starting with an initial value, then multiplying by unity values (=1) to convert to other units. Similar units values will cancel leaving the final value and units.
I think you may be confusing the conversion factors.. "
1/52
" would be a "years per weeks" conversion which doesn't help when starting with days.