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

object-oriented programming

In OOP challenge task 2 of 2, do I need to create two arguments (open, close) for the method?

How do I write this in the return statement?

method.py
class Store:
  open=8
  close=5

  def hours(self):
    return "We're open from ", self.open(), "to", self.close()

1 Answer

Devin Bartley
Devin Bartley
2,800 Points

Hi Katy,

You are really close, but it is asking for you to "pass in" the keywords. The way to pass in keywords into a sentence works like this:

return "I am going to {} in some {} now".format("pass", "words")

the above statement will return this:

"I am going to pass in some words now."

So you just need to do that with self.open and self.close in they way they specify. Finally you don't need the parenthesis after self.open and self.close since they aren't methods. Good luck!