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 trialWayne Hall
124 Pointstask one will work then on the next section it wont. I'm so confused and there isn't sufficient direction.
task one will work then on the next section it wont. I'm so confused and there isn't sufficient direction.
class Store:
close = 1
open = 2
def hours:
return "We're open from {} to {}." .format(open, close)
2 Answers
Chris Freeman
Treehouse Moderator 68,454 PointsHi Wayne,
When doing a second task, if task one fails it usually means a syntax error was introduced hence stopping all previous tests from passing.
It looks like there was an extra space before the format()
method.
class Store:
close = 1
open = 2
def hours(self): #<-- include 'self' as the instance reference
return "We're open from {} to {}.".format(self.open, self.close) #<-- removed space before ".format"
Arnab Sharma
Courses Plus Student 218 Pointsclass Store:
open = 9
close = 12
def hours(self):
return "We're open from {} to {}".format(self.open , self.close)