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) Logic in Python Fully Functional

Joshua Sklodowska
Joshua Sklodowska
1,146 Points

.lower

I've seen .lower used twice now and I don't understand what it does.He seems to be throwing it in there. I'm just curious. Not sure it's relevant to the challenges though.

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

The str (string) object has several methods available for operating upon itself. The method (so called because it is a function bound to an object) .lower() operates upon the string it is bound to, returning a lower-cased version of the string, but leaving the original string unchanged:

media$ python3
Python 3.4.0 (default, Jun 19 2015, 14:20:21) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> string = "CamelCaseString"
>>> string.lower()
'camelcasestring'
>>> string
'CamelCaseString'

This function converts a string to all lowercase. e.g. "FOO" would become "foo".