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 trialThomas Covington
Courses Plus Student 203 PointsI need to create a variable name days; multiply my age by 52, pretend today is my birthday and multiply by 7.
My code is: days = (67)(52)(7) where did I go wrong?
age = int(67)
days = int(67)(52)
2 Answers
George Zabel
5,194 PointsFirst off, to multiply, you have to use a *. Parentheses do not multiply stuff in Python, they are only used for order of operations. So if you're multiplying 5 times 5, you'd write
5 * 5
, not
5(5).
So now to the actual code. You'd want to take your age variable on line 1, then multiply it by 52, then multiply by 7.
Here's an example, to avoid spoilers: Double the amount of eggs you have:
eggs = 2
double_eggs = eggs * 2
You can name the variables on the left side of the equals signs anything you want (or what the assignment asks you to name them)
Cory Madden
7,120 PointsThat's not the correct syntax for multiplying in Python. To multiply two numbers use the * symbol.
days = 3 * 4