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 (Retired) Things That Count Things That Count

In which universe is your age in days equal to your age in years multiplied by 52 and divided by 7?

This is from the code challenge in the "Python - Things That Count" course, asking, "Now, create a variable named days that is your age multiplied by 52 (we'll pretend today is your birthday) and divided by 7."

6 Answers

The parentheses do not matter since multiplication and division have equal arithmetic precedence and are evaluated from left to right. My question is in regards to calculating the age of an individual in days, given the age in years. Should it not be age in days = (age in years) * 52 * 7?

Oh, sorry for that. I misunderstood the question.

Actually, yes, you are right. The days should be equal to years * 52 * 7. Now I'm confused too. :)

LOL! Thanks for the confirmation. I wanted to make sure I wasn't going crazy. :-)

days = age * 52 * 7


In the first part of the challenge you created a variable age = 27 (for example).

So for this part you should do this.

days = (age * 52) / 7.

It's best to put age * 52 in parentheses because that way you make sure that this part of the equation will be executed first and then the result will be divided by 7.

Good luck with the 3rd part of the challenge. :)

my friend !!! you were confusing me all the time :) days = (age * 52)*7 it was not divided :) ahhh was looking what is wrong there :D

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Yeah, it's not correct math for getting the days alive. But, it's also not wrong :) You have been alive at least that number of days.

Seriously, though, I need to replace this one with a better code challenge. Thanks for the reminder.

Ha ha ha. That's true.

You're a cool guy, Kenneth. I love your videos almost as much as you love Python!

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

I updated the code challenge to be more sane. Added a 4th step, but the math actually makes sense now. Feel free to work through it again, adamtatusko

Good work, Kenneth. I did this code challenge again and I like it a lot better now! I'm looking forward to taking new Python courses from you when you release them.

Leo, it was a rhetorical question due to a problem with the code challenge. See above.

Very simple confused question :)

age = 23 days = (age * 52) * 7