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 trialRommel Rodriguez
2,548 Pointsexactly, does python recognize plurality?
in the tuple example. i understand when you say that exactly and the uppercase does not match however the keyword for the search was "tuple" (which it found one instance, so does python recognize plurals?
4 Answers
Steven Parker
231,236 PointsPython only matches strings on a character-by-character basis, the words made up by the characters have no meaning to Python directly. It has no idea if the string is singular or plural, or even a word at all.
Sometimes the forms of a word are only different by the addition of one letter (usually "s"), so a string search for the singular form will find it inside the plural, but this is entirely due to character matching individually.
Jonathan Davidson
1,641 PointsI had the same question, so I played around with the code. It finds characters inside the string as long as the case is the same. So for instance, you could search for 'mut' and it will find it inside immutable. However, if you searched for 'Mut' it would not work. So it's not that python understands the plurality of 'tuples,' it's just finding 'tuple' inside 'tuples.'
marin stefan daniel
5,422 Pointsit will find "app" both in "apples" or in "apps" ... it just looks for the letters "app" ... with our example "tuple" and "tuples" it is just a coincidence that it actually is the plural
Sergio Andrés Herrera Velásquez
Python Development Techdegree Graduate 12,788 Pointsthere are some third party modules that will allow for pluralization of words as in the following link https://www.geeksforgeeks.org/python-program-to-convert-singular-to-plural/
so if you could make it plural, I believe you could use that same logic to reverse the search