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 Object-Oriented Python (retired) Objects Create a Class with a Method

creating a Class with a method

Now, add a method named hours that returns "We're open from {} to {}.". Replace the first placeholder with the open time and the second with the close time. Remember you need to pass keywords to .format() if your placeholders have names.

method.py
class Store(object):
 open=9
 close=10
   def hours(self):
    return "We're open from {} to {}.".format(self.open,self.close)

pliz help, where am i getting wrong there because its now saying task 1 nolonger passing

1 Answer

hie wellington. I copied and pasted your code and besides indentation it looks just fine. correct your indentation, make sure that the three lines that follow after class are indented with four spaces i.e open, close and def, then indent your return four spaces also. NB. the error comes if you indent the def key word, this appears as if the function falls under the variable close so outdent def

thanks very much it did work out well