Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 10 Online
OpenStudy (coolguy123):

HELP. I'm having trouble with ps5. I want to use a method from the superclass, but it doesn't seem to work out. Here's what i did http://pastebin.com/HJyAHGUe

OpenStudy (anonymous):

Hi CoolGuy, What language is that? I'm having trouble without braces

OpenStudy (coolguy123):

python

OpenStudy (rsmith6559):

I would think that: return self.evaluate(story.get_title()) would be all that's needed. When you inherit from a class, it's methods come into the child class's namespace.

OpenStudy (coolguy123):

i thought that too, but if i do return self.evaluate(story.get_title()) i get an error, saying that a str type doesn't have get_title() attribute

OpenStudy (rsmith6559):

TBH, the posted code is just classes. There's no implementation (running) code, so I can't troubleshoot the problem.

OpenStudy (anonymous):

first thing i noticed, when you initialize a newsStory instance why are you specifically converting the bit of the news story to a string? you could just have self.guid = guid etc. in your TitleTrigger class, why are you setting word = self? when you define your is_word_in method, you forgot to add a self in the def line it should look like this: def is_word_in(self, text)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!