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 (2015) Python Data Types Age Calculation

kevin burns
kevin burns
2,570 Points

plz what's wrong

I thought I the code right ... guess not...

age.py
years = 41   
years * 365 =  days

3 Answers

andren
andren
28,558 Points

You have the assignment the wrong way around. Remember than in programming the = symbol is not used to declare two things as equal, like it does in math, but to assign a value to something.

That means that to assign years * 365 to days you have to have days on the left side of the equals sign. Like this:

years = 41   
days = years * 365
Afloarei Andrei
Afloarei Andrei
5,163 Points

use the variable first, then assign the value

kevin burns
kevin burns
2,570 Points

thanks that worked!!