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

This doesn't make any sense.

What am I doing wrong?

I am trying to create a variable named "years" which has a value of "22." Isn't this written as:

years = "22"

??????????

age.py
years = '22'

1 Answer

Nathan Tallack
Nathan Tallack
22,159 Points

When you put the 22 inside the quotes it becomes a string rather than an integer.

So:

years = '22'  # This is a string, as in the characters rather than the number.
years = 22  # This is an integer.  This is stored as a number rather than a string.

I hope this helps! Keep up the great work! :)

Thank you for your quick reply!! I really appreciate it Nathan.