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 trialMUZ140907 Wellington Maredza
3,014 Pointscreating 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.
class Store(object):
open=9
close=10
def hours(self):
return "We're open from {} to {}.".format(self.open,self.close)
1 Answer
MUZ140889 Dephine Chenayi Chihota
6,766 Pointshie 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
MUZ140907 Wellington Maredza
3,014 Pointsthanks very much it did work out well
MUZ140907 Wellington Maredza
3,014 PointsMUZ140907 Wellington Maredza
3,014 Pointspliz help, where am i getting wrong there because its now saying task 1 nolonger passing