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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Luke Tate](https://secure.gravatar.com/avatar/f75a2384ba0172ad7547a937279cb605?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Luke Tate
Courses Plus Student 2,256 PointsWhy doesn't my string get approved by "Check Work"?
Whenever I type the second string into either the function, class or both, I always get an error? The preview never is available. What am I doing wrong?
1 Answer
![Jeff Muday](https://uploads.teamtreehouse.com/production/profile-photos/5900142/micro_jeff_face.jpg)
Jeff Muday
Treehouse Moderator 28,718 PointsYou won't be able to see anything in the preview related to the docstrings. It is unfortunate that having the "Preview" option is there since it doesn't do much for this particular challenge.
Below is a solution to challenge 1 of 2 as an example of what the Challenge grader is looking for. You should have no trouble figuring out part 2 on your own. Note that both a class and its methods can have docstrings. These docstrings are immediately below the declaration line and can use three single-quotes or double-quotes for delimitation. They can be on multiple lines to support extended or complex strings.
DocStrings are an easy way to document code and many IDE (integrated development environments) and Documentation generation tools can use the Docstrings in ways to inform users of the intent of a class or method and valid parameters that are passed. Some documentation generators produce beautiful PDF and HTML documentation using DocStrings so it is really worthwhile investing the time to type these in if you think your code is destined for lots of reuse!
class Treehouse:
def student(self, name):
"""Gives a pleasant message about the student."""
return '{} is a great Treehouse student!'.format(name)
Joseph Yhu
PHP Development Techdegree Graduate 48,637 PointsJoseph Yhu
PHP Development Techdegree Graduate 48,637 PointsCould you provide us with your code?