Classes and Objects with Python – Part 1 (Python Tutorial #9)

///Classes and Objects with Python – Part 1 (Python Tutorial #9)

Classes and Objects with Python – Part 1 (Python Tutorial #9)

FavoriteLoadingAdd to favorites

Object oriented programming (OOP) in Python – let’s go!

Introduction to Classes and Objects:
Download the sample file here:
You can find this entire series in a playlist here:

And keep in touch on Facebook:

source

By |2019-06-19T19:55:14+00:00June 19th, 2019|Python Video Tutorials|49 Comments

49 Comments

  1. Chinmoy Chowdhury June 19, 2019 at 7:55 pm - Reply

    hello, cs dojo, whenever I try to execute init function as per your instruction, it is showing a syntax error, I can't understand why. But, if i use your earlier method (without using constructor), it runs well. can u help me understand the reason? tnx

  2. Grungydan June 19, 2019 at 7:55 pm - Reply

    Your vids are way better than the ones out of a course I paid for. Thanks so much for taking the time. Consider me subscribed!

  3. Springbo June 19, 2019 at 7:55 pm - Reply

    Thank youuu, understanding classes has been really challenging for me and this is starting to help ๐Ÿ™‚ great examples

  4. coscinaippogrifo June 19, 2019 at 7:55 pm - Reply

    We miss you man!

  5. Angus Benjamin June 19, 2019 at 7:55 pm - Reply

    What if you wanted to retrieve r1 or r2โ€™s info after youโ€™ve defined the object

  6. TootingVampire June 19, 2019 at 7:55 pm - Reply

    Thanks for uploading mate! massive help ๐Ÿ™‚

  7. Mohammed Fayaz June 19, 2019 at 7:55 pm - Reply

    very well explained. Thankyou sir

  8. RAVINDRA KUMAR June 19, 2019 at 7:55 pm - Reply

    Bhosadi ke see your face as a rat bhosadi ke

  9. tjappa schuur June 19, 2019 at 7:55 pm - Reply

    print("you are amazing!")

  10. Alexa Green June 19, 2019 at 7:55 pm - Reply

    Why do u use Jupiter ???

  11. Siva rajan June 19, 2019 at 7:55 pm - Reply

    Respects to you my Asian Brother!! ๐Ÿ™‚

  12. Giulia Coutts June 19, 2019 at 7:55 pm - Reply

    got any stand up videos?

  13. Himanshu June 19, 2019 at 7:55 pm - Reply

    Good job !!!

  14. Rajeev Anand June 19, 2019 at 7:55 pm - Reply

    Very well explained. Thank you

  15. Ferin Patel June 19, 2019 at 7:55 pm - Reply

    Which software do you use to explain the concepts. The software with black background and clicking on boxes and they appears

  16. Tin Yee Chiu June 19, 2019 at 7:55 pm - Reply

    Great!

  17. Abhinit Rai June 19, 2019 at 7:55 pm - Reply

    The Weight attribute had to be passed off as string type instead of int type to get the desired output

  18. Abhinit Rai June 19, 2019 at 7:55 pm - Reply

    Error "Name Robot is not defined". Why?????
    It seems that I have written the code correctly as I have also verified from your sample code, still I am getting this error.

  19. Daniel Zvarici June 19, 2019 at 7:55 pm - Reply

    Thank you! Keep up the good work!

  20. Abhinav tyagi June 19, 2019 at 7:55 pm - Reply

    why you add color and weight if you never used them?

  21. SUPER FAHER June 19, 2019 at 7:55 pm - Reply

    Make sure to go on my youtube channel to see my python lessons https://www.youtube.com/watch?v=XDJ70JfEn40&t=214s

  22. 7 lyrics June 19, 2019 at 7:55 pm - Reply

    thanks yk

  23. Vaibhav Bodhane June 19, 2019 at 7:55 pm - Reply

    is there any compulsion to use word init as constructor?

  24. MD. IMRAN UDDIN June 19, 2019 at 7:55 pm - Reply

    If I'm print the color and weight as same as name, what can I do first?
    I've done this but doesn't work.
    def introduce_self(self):

    print("My name is " + self.name)

    print("Color is " + self.color)

    print("Weight is " + self.weight)

    error is:
    line 27, in <module>
    r1.introduce_self()
    line 11, in introduce_self
    print("Weight is " + self.weight)

    TypeError: can only concatenate str (not "int") to str

  25. Schaaf Plays June 19, 2019 at 7:55 pm - Reply

    Nice job

  26. Soniya Goel June 19, 2019 at 7:55 pm - Reply

    You are the best tutor. No one else can teach like you.

  27. Abhinav Bhatt June 19, 2019 at 7:55 pm - Reply

    this looks very weird compared to java

  28. BHAVIN DAVE June 19, 2019 at 7:55 pm - Reply

    Came here after ex40 of LPTHW. Your explanation is crystal clear. Thanks.

  29. RAWR Coding June 19, 2019 at 7:55 pm - Reply

    Great video!

  30. Tanuja Agarwal June 19, 2019 at 7:55 pm - Reply

    awesome..can not be simpler than this ..nice style..

  31. sanaka banerjee June 19, 2019 at 7:55 pm - Reply

    hi my code is showing that Robot takes no arguments, what can be the reason? i did everything as mentioned

  32. Gaurav Singh June 19, 2019 at 7:55 pm - Reply

    Hello cs dojo, your content is really fantastic and of high quality, but as a beginner I faced challenge in classes and object and your content too was a bit tough for me understand. But later on I came to know about this : https://courses.edx.org/courses/course-v1:IBM+PY0101EN+1T2019/courseware/89227024130b43f684d95376901b65c8/60403dfa4e5242bda3c44ce9940fdc90/1?activate_block_id=block-v1%3AIBM%2BPY0101EN%2B1T2019%2Btype%40vertical%2Bblock%40a46f3c3f76464a74b577e59102616090 ……. this is edx ibm classes and object. I find it much broader in concept wise and they even used much simpler way to teach .. hope helps somewhere

  33. Thank you

  34. Brian Maugo June 19, 2019 at 7:55 pm - Reply

    hi guys, here is my code and i am kinda stuck,someone please help;
    class Robot:

    def _init_(self, name, colour, weight):

    self.name=name

    self.colour=colour

    self.weight=weight

    def introduce_self(self):

    print("my name is " + self.name)
    #r1=Robot()

    #r1.name="Robert"

    #r1.colour="Red"

    #r1.weight=30

    #r2=Robot()

    #r2.name="Jerry"

    #r2.colour="Blue"

    #r2.weight=40

    r1 = Robot("Robert", "Red", 30)

    r2 = Robot("Jerry", "Blue", 40)
    and this is the error i keep getting;
    NameError Traceback (most recent call last)

    <ipython-input-1-646c5cda234a> in <module>

    8 #r2.colour="Blue"

    9 #r2.weight=40

    —> 10 r1 = Robot("Robert", "Red", 30)

    11 r2 = Robot("Jerry", "Blue", 40)

    NameError: name 'Robot' is not defined

  35. Tanner Barcelos June 19, 2019 at 7:55 pm - Reply

    Itโ€™s funny cause I learned this all last semester , and now Iโ€™m in c++ with data structures and I canโ€™t tell you how consumed Iโ€™m in with python that I have like lost all my python ๐Ÿ˜‚ one or two quick videos itโ€™s right back though!

  36. Brian W June 19, 2019 at 7:55 pm - Reply

    Great Job, well done sir…Keep up the great work!!!

  37. Astrix June 19, 2019 at 7:55 pm - Reply

    The best!

  38. Nabeel Saoor June 19, 2019 at 7:55 pm - Reply

    tom and jerry, clever.

  39. Jiayi HE June 19, 2019 at 7:55 pm - Reply

    wtf this is soooo helpful

  40. PinkyIsSnug June 19, 2019 at 7:55 pm - Reply

    help whenever i try to make the constructor it comes up with a syntax error after the colon. can anyone help?

  41. Pratap khandekar June 19, 2019 at 7:55 pm - Reply

    You are great

  42. Quote Goat June 19, 2019 at 7:55 pm - Reply

    Dear Maddu Sudan, get out of youtube

  43. german prada June 19, 2019 at 7:55 pm - Reply

    How does he comment the entire block at 9:16 ?

  44. Batuo Gaston/ Braggs June 19, 2019 at 7:55 pm - Reply

    i Had also love to see you creating some important but moderately short programs while using OOP.

  45. Batuo Gaston/ Braggs June 19, 2019 at 7:55 pm - Reply

    Nice tutoring as always but i think you should start adding subtitles in your lectures. Some of us have ear defects as well as not able to follow the lectures on fast paste explanations. Hope that would be adjusted

  46. All day June 19, 2019 at 7:55 pm - Reply

    def introduce_self(self):

    print(self.name, self.color,self.weight,self.teeth )
    will print all the informations together.

  47. John Horton June 19, 2019 at 7:55 pm - Reply

    What did you use for the presentation at the start please?

  48. Your videos are te best!!

Leave A Comment

*