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 trialMONTRIAL HARRELL
Python Web Development Techdegree Student 2,150 PointsAttribute Error - type object 'Bookcase' has no attribute 'create_bookcase'
I am getting an attribute error when I try yo use Bookcase.create_bookcase. Can anyone see my error?
class Book: def init(self, title, author): self.title = title self.author = author
def __str__(self):
return '{} by {}'.format(self, self.title, self.author)
class Bookcase: def init(self, books=None): self.books = books
@classmethod
def create_bookcase(cls, book_list):
books = []
for title, author in book_list:
books.append(Book(title, author))
return cls(books)
1 Answer
MONTRIAL HARRELL
Python Web Development Techdegree Student 2,150 PointsI figured it out. I had a error in indentation and found another error in my Book definition as well. Thanks!!