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 Instant Objects Method Arguments

Im starting to get very confused from this course onwards

From OOP Python im starting to find it very hard to understand and follow along anymore, please can I have some advise as I have tried learning python multiple times and never seem to give up, im determined, thanks!

Steven Parker
Steven Parker
231,198 Points

Determination is good, since plateaus and temporary setbacks are all normal parts of the learning process.

You might find something useful in the bonus series course How to Learn.

16 Answers

Scott Bailey
Scott Bailey
13,190 Points

I think a lot of people start getting a bit stuck at this point - I didn't find his videos that clear around this point as well.

My advise is to combine the treehouse videos with some tutorials on places like youtube or to try some books as well. In combination it should help make it a bit more clear.

Even if you still don't fully understand I would reccomend to keep going forward with the course, you'll end up asking more questions and hopefully getting good answers (especially when it comes to the code challenges). A bit of repetition will help it sink in as well.

If you're determined keep pushing forward and it will start to make sense eventually!

Im watching Corey Shaefer!

Corey Schafer is a great teacher. I just came to recommend his videos and saw your comment.

Itsa Snake
Itsa Snake
3,852 Points

I just came here to comment that this guy is a dreadful teacher. The track was going very well and now i'm suddenly demotivated, feeling like i've learnt nothing.

He doesn't explain or connect anything and it feels more like he's just showing off how good at coding he is.

Hi,

I agree his videos have been horrible and show-offy. I took the advice of someone who posted and watched Corey Shaffer's Python OOP Tutorial videos on YouTube. I completed the challenge easily after. He explains it in a fantastic, easy to understand way!

I hope it's going well! Brittany

I think part of the problem is that he uses a horrible example/topic. Also, he doesn't really explain or connect what he's doing with his code vs what he's doing in the REPL.

There's a guy on YouTube name Corey Schafer that has a group of OOP videos that spell out the topics very clearly. I watched those videos and then came back to Kenneth's videos just so I could do the code challenges. Also, I've been replacing his classes, methods, etc... with ones that are more meaningful to me.

Thank you, i've heard of Corey, I will watch more of his videos, Kenneth here is awesome, but he just confused me with this topic

Tomislav Miletic
Tomislav Miletic
1,442 Points

From this OOP lesson, i am just lost. This guy just talks, doesnt explain anything. I found better videos on YouTube for OOP in Python, that are free.

Until this point, i was able to understand the whole track, last teacher Craig Dennis is much much better.

The only thing truly annoying me about this course is the code challenges. They require you to do things that either weren't covered in the videos leading up to them or wants something specific that wasn't telegraphed very well. Then there's the lack of feedback when it rejects your code (something I've not seen in other treehouse videos). "Bummer: Try again!" is going to haunt my dreams.

Hi Nick,

So what you are experiencing is normal. This is one of the drawbacks of video learning, is that it's lacking the two-way communication that a class offers. Fantastic suggestions from both Steven Parker and Scott Bailey. I agree that often you will need to add to your material.

Depending on your learning style, I found that supplementing my video learning with a book (there are some fantastic books about learning Python) can really help with understanding the language.

  • Zed Shaw's "Learn Python the Hard Way" (my personal favourite)
  • Eric Mathew's "Python Crash Course"
  • John Zelle's "Python Programming: An Introduction to Computer Science"

Sometime it also help to take a break, come back and revisit the language. Sometimes visiting the same concept in another language gives you that "ah-ha!" moment you need, which will allow you to grasp what you were originally trying to understand.

Lastly, lean on the community as much as possible. We've all been in the same situation at one point or another, and are usually can offer insight into getting past certain roadblocks.

Persevere, be patient with yourself and all the best continuing on your code-learning journey!

This teacher is awful. Craig Dennis was much better. How has Treehouse not done anything about this?

What would also help is if he created the instances in the editor as opposed to only creating them in the REPL. That would clarify a lot.

Simon Chalder
Simon Chalder
4,293 Points

This example I found online was helpful for me and I agree the videos on this topic are pretty confusing. 'p1' in this example is an object created from the Person class template and it's arguments 'John' and '36' populate the objects variables name and age. The class is kind of like a blank form with fields to be filled out.

class Person: 
  def __init__(self, name, age): 
    self.name = name 
    self.age = age

p1 = Person("John", 36) 

print(p1.name) 
print(p1.age)

As for setattr as I understand it when creating our class we have self.name, self.age etc.

for key, value in kwargs.items():
            setattr(self, key, value)

This setattr is basically looking for a dictionary from **kwargs and will create self.dictionary_key and self.dictionary_value in addition to self.name and self.age.

Does this sound right?

Yea I hate to pile on but this is a pretty poorly created lesson compared to all of the others I have done so far which were amazing. I think they should delete this one and create a new one for this material.

In the meantime, the Corey Schafer OOP vids are great. I'll watch those before returning to this mess.

Scott Bailey
Scott Bailey
13,190 Points

I know it shifts the topic of the thread a bit but this is what helped me when getting stuck.

If I really coudn't figure the challenge out I would find the code that would pass, then break it down and read through it to slowly piece together what it is actually doing.

You don't have to do this, but it always helped me out:

First Task:

class RaceCar(object):
    def __init__(self, color, fuel_remaining, **kwargs):
        self.color = color
        self.fuel_remaining = fuel_remaining

        for key, value in kwargs.items():
            setattr(self, key, value)

Second and Third:

class RaceCar(object):
    def __init__(self, color, fuel_remaining, **kwargs):
        self.color = color
        self.fuel_remaining = fuel_remaining
        self.laps = 0

        for key, value in kwargs.items():
            setattr(self, key, value)

    def run_lap(self, length):
        self.fuel_remaining -= (length * 0.125)
        self.laps += 1

Like you're doing though, theres no harm in moving on to a different topic for a bit then coming back to ones you got stuck on!

I wish you the best of luck, you will get there!

Agreed, this lesson is sub-par for Treehouse The code challenges are very unclear to what would be successful. I had working code (Verified by running at online-python.com) yet it wasn't passing.

I'll add my two sense worth on this topic, not impressed.

Something is missing between the code challenges and the teachers examples. They are completely out of sync. When paying good money for a course I expect the code challenges to build on the core concepts being taught, if I have to spend time googling, reading articles on how to use something like 'yields' it's wasting my time.

Using the answer that you have plateau'ed or that Googling is normal, is partially correct, but not this much time. Have been coding for a number of years and never had to spend this much time outside a training course looking for concepts that should have been explained with clear examples, and emphasised with the code challenges.

The frustration has reach such a point that I'm simply copying and pasting other peoples code to get through the last code challenges to get out of this brutal section, b/c all I wanted this course for was a prereq for the Data Structures and Algorithms course.

I nearly gave up today, team tree house. you really need to update your script. No. explanation whatsoever. All I did was stare at the screen.

Im still stuck, and can't complete the end task :(

Coreys videos have helped, but i even started getting confused towards the end of that too

Scott Bailey
Scott Bailey
13,190 Points

Is it the RaceCar challenge?

yep! :/

I've now just moved on to writing better python because that is holding me back and demotivating me too much

Im also stuck on the other topics too, i also still don't think i can do this racecar challenge