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 trialAdam Tatusko
16,589 PointsIn 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
Adam Tatusko
16,589 PointsThe 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?
Leo Berisha
438 Pointsdays = age * 52 * 7
tihomirvelev
14,109 PointsHello,
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. :)
Mohammad Ferooz Ahad
358 Pointsmy 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
Treehouse Guest TeacherYeah, 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.
Adam Tatusko
16,589 PointsHa ha ha. That's true.
You're a cool guy, Kenneth. I love your videos almost as much as you love Python!
Kenneth Love
Treehouse Guest TeacherI 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
Adam Tatusko
16,589 PointsGood 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.
Adam Tatusko
16,589 PointsLeo, it was a rhetorical question due to a problem with the code challenge. See above.
ellie adam
26,377 PointsVery simple confused question :)
age = 23 days = (age * 52) * 7
tihomirvelev
14,109 Pointstihomirvelev
14,109 PointsOh, 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. :)
Adam Tatusko
16,589 PointsAdam Tatusko
16,589 PointsLOL! Thanks for the confirmation. I wanted to make sure I wasn't going crazy. :-)