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 trialchey pettitt
657 Pointsstuck on maths
i need to make a variable that is age (my age 28 multipled by 52 multiplyed by 7 ? im stuck
age = int("28")
3 Answers
Orestis Pouliasis
5,561 Pointsage = 25
days = age * 52 * 7
summary = 'I am {} days old!'.format(days)
Here's the solution to the code chalange. In python, you multiply with "*",add with "+",divide with "/", substract with "-".
Robert Richey
Courses Plus Student 16,352 PointsHi Chey,
In python, you can initialize a variable with a number, without having to cast it to an int from a string.
# the string "28" is changed (or, cast) to an integer and assigned to the variable age
age = int("28")
# the number 28 is assigned to the variable age
age = 28
Next up, create a variable named days
and assign to it the math expression age * 52 * 7
Please let me know if this helps or not!
chey pettitt
657 Pointsi think im there thanks
chey pettitt
657 Pointschey pettitt
657 Pointsthaqnks i managed to work it out but i had to think about it but cheers