Python Tutorial for Beginners 15 – Classes and Self



In this Python Tutorial for Beginners Video, I am going to show you how to Create and Run Your First Python class. In Python, everything is an object i.e. integers, strings, dictionaries, …
Class objects are instantiated from user-defined classes, other objects are from language defined types. Classes In python Can be defined anywhere in the program. In this video I am going to give you two Python Class examples.
——————-Online Courses to…

, , , ,

42 thoughts on “Python Tutorial for Beginners 15 – Classes and Self

  1. confusing whats the use of this ….. all the previous lessons went well except this one ….. very confusing and seems useless unless you can put the code in a real example so we could see. will try to know about it outside the channel

  2. I am very sad please help me with undrstanding this concept class I have tried too many times but always failed

    I am 9 year old trying too understand please Is there anyone who can help me

  3. After showing your video, I tried but can't" . Where is the mistake I made:
    class Person :
    def setFullName(self,firstName, lastName):
    self.firstName=firstName
    Self.lastName=lastName
    def printFullName(self):
    print(self.firstName, "", self.lastName)

    PersonName=Person()
    PersonName.setFullName("Programming" ,"Knowledge")
    PersonName.printFullName()

  4. class Person:
    def setFullName(self,firstName,lastName):
    self.firstName=firstName
    self.lastName=lastName
    def printFullName(self):
    print(self.firstName," ",self.lastName)

    personName=Person()
    personName.setFullName("programming","Knowledge")
    personName.printFullname()

  5. What does self do? You didn't make any variables in the class. What is the difference in using the variables with self, amd then without it. Cause sinse they are just the parameters of a method, they exist only in that method. So it means that the other method Shouldn't be able to use it. You didn't declare them as global, did you?

  6. great job, but it is a method or function, it 's confusing a bit because up to my knowledge, the only method will be written inside class and function outside the class..

  7. Wouldn't it be simpler and easier if I just write a function to print the name of a person?
    The result is the same. Why should I use 'self' and define a class?

    def person(firstName,lastName):
    print(firstName,' ', lastName)

  8. I am a super beginner at Python trying my best to understand the world of computer programming and I am honestly flummoxed and bewildered by the concept of "class". I'm sure for some this part of the tutorial may prove to be useful, but that wasn't the case for me….it's my fault, not yours. If you can explain this video in a different way or give me a link to a document/video regarding this topic that would be very helpful

    Thank You So Much!

    -im 15 in the ninth grade, if that's any indication of my aptitude in comp. programming. However, I did understand your previous videos perfectly, but just not this one!

Leave a Reply

Your email address will not be published. Required fields are marked *