Python Tutorial for Beginners 15 - Classes and Self

preview_player
Показать описание
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.
★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!

Verwandte Suchanfragen zu python class
python class example
python class self
python class object
python class constructor
python class attributes
google python class
python class variables
python class name
Рекомендации по теме
Комментарии
Автор

I liked most of your videos, but this one is particularly confusing

fercholin
Автор

So as I understand: Class is folder of defs, and self is access for other scripts to use functions inside the class even if scripts outside the class

maratyla
Автор

Reviewed several tutorials on python classes and thought this was one of the best

bgilbert
Автор

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)

inesborges
Автор

All of your videos are awesome man but this video is so much create confusion !!

bhargavshah
Автор

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

shivamjha
Автор

thanks for posting about methods and attributes

markwiygul
Автор

u tried it good but if a newbie will watch it to get understand your concept sure he will get confused so record it again

rockyrock
Автор

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!

johnpauledrittbinay
Автор

WHATS THE NEED OF SUCH A HUGE
I can do the same thing what you did in just two lines -

def abc(firstName='programming', lastName='knowledge'):
print(firstName, lastName)






now just run it and in the py shell just write -
abc()
it will give the the output - programming knowledge (i.e the first and last name)
#you can also overwrite the name above by giving another first and last name in the argument


so what's the need of classes('you haven't explained it prooperly for a beginner)

ayush
Автор

can I use functions in array as used in a class and call them?

nurmohamad
Автор

Sir, That self, need not be always self right, we can use any other word ?
Is it possible to create any function without that self also ?

SureshKumar-uctz
Автор

Not good at all, record it with a better explanation and explain more precise. This tutorial makes a beginner more confused about Class and Self in python

arminyz
Автор

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()
, "Knowledge")
PersonName.printFullName()

md.shorifulislam
Автор

Confusing. since it is for beginners. It would be good if you would have overviewed the what is a class, object and its purpose.

tarasensemble
Автор

sir i got an error like this will you explain it for me (Traceback (most recent call last):
File "C:/Users/user/AppData/Local/Programs/Python/Python39/class.py", line 7, in <module>
personName=Person()
NameError: name 'Person' is not defined) please sir

ramakrishna
Автор

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?

ericbridge
Автор

should be done with precise and toke good stuff which is easier for the audience

emzyvines
Автор

Why didn't u use the id in the destructor function? But you printed it there. Why did this happen?

pushparay
Автор

great job, very easy to understand !!!

MrVineet
welcome to shbcf.ru