Object Oriented Programming with Python – Full Course for Beginners
September 6, 2024 2024-09-06 10:16Object Oriented Programming with Python – Full Course for Beginners
Object Oriented Programming is an important concept in software development. In this complete tutorial, you will learn all about OOP and how to implement it using Python.
💻 Code: https://github.com/jimdevops19/PythonOOP
🔗 Tutorial referenced for a deeper explanation about __repr__: https://www.youtube.com/watch?v=FIaPZXaePhw
✏️ Course developed by Jim from JimShapedCoding. Check out his channel: https://www.youtube.com/channel/UCU8d7rcShA7MGuDyYH1aWGg
⭐️ Course Contents ⭐️
⌨️ (0:00:00) Getting Started with Classes
⌨️ (0:12:11) Constructor, __init__
⌨️ (0:50:35) Class vs Static Methods
⌨️ (1:13:22) Inheritance
⌨️ (1:30:14) Getters and Setters
⌨️ (1:51:00) OOP Principles
🎉 Thanks to our Champion and Sponsor supporters:
👾 Wong Voon jinq
👾 hexploitation
👾 Katia Moran
👾 BlckPhantom
👾 Nick Raker
👾 Otis Morgan
👾 DeezMaster
👾 AppWrite
—
Learn to code for free and get a developer job: https://www.freecodecamp.org
Read hundreds of articles on programming: https://freecodecamp.org/news
source
Comments (50)
@jimshapedcoding
Thanks a lot for posting this, FCC! ❤️
@carlosdavid2186
The way you explain is great!. I understood several things that struggled with before.
@aavalos163
Thank you for sharing. Best tutorial that I have ever seen on Python Object Oriented Programming.
@lyhourtte
this help a lot
@averageamerican6727
Epic.
@minhbaooan5670
Thank you!
@karthickbalaji4501
Thank you! this helped me a lot!!
@alhabib_o
can someone tell what is this THEME ?
@blacksundarkskies
this is great
@707jeevan
The best Tutorial video I have seen till date for Python Programming
@SyedMohommadKumailAkbar
Please rename the video title, it is very misleading. This maybe a good course for people who already know OOP to refresh their concepts and understand them better but is absolutely not for beginners. There is no clear guidance on why anything is being done, there is neither flow nor structure, just adhoc command giving and typing. As a true beginner in OOP, not once was it clarified why this is needed (in python for eg) to begin with, rather than write out flat code.
As this was an assigned video for a course, I had to unfortunately drag myself through it. But everything I learned about OOP, i got from reading blogs online and other videos that actually make the effort of telling why something is being done, what the end objective is, and how writing code the way it was written here helps us do that better.
@melselvagem
Thank youuuuuuu❤
@mohammadafshan4846
best video to understand oops, heartfull thank to instuctor CRYSTAL CLEAR EXPLANATION
❤
@RAFA-tg3yt
thanks jim, you're an absolute legend
@SandipMishra-vp4uw
It was So helpful ,Thank you
@tec4321-e5o
Thank you🤝
@hellno3091
too many fuckin adds … really annoying
@numanhafeez8627
Staticmethod and classmethod have really confused me..
@ZainabFarrukh-j5q
class vs static method was difficult to understand.As a beginner , i had no idea about csv and the thing going on with it😖😩
@jtrenchard1974
I have a basic (probably) but important problem. When you instantiate manually e.g. 'item1 = Item("MyItem", 750)' you call methods e.g. 'item1.name = "OtherItemmmmm"' , but I am working with the csv instantiation.
How do you refer to an instance of an object that has been instantiated from the csv to call a method then as they have not been given a name?????
Any help gratefully received,
Thanks
Edit: I think I have solved it:
The list is more than just a list, it actually points to the objects??, I used:
for i in Item.all:
if i.name == "Phone":
print(i.calculate_total_price())
i.name = "Phone3"
print(i)
Because the i.calculate_total_price() worked, it must be pointing to the instantiated object right??
I then wrote a method to write back to csv all the items in the list and it worked!!!
Item.write_to_csv()
Tell me if I am wrong, but it seems to be fine.
@swathi-sv
Is this video is only for oops concept…..I have to learn ooops concept will this video helps me ?
@MahmoudBacha.r.s_personal
Excellent content , well and deeply explained.
Good reference
@Toad-Sage-
23:31
@Mmm-le9dp
I have a question about the setters. I didn’t understand when I should use them. It seems that all its doing is negating the read only property and if I don’t want an attribute to be a property shouldn’t I just remove the property why implement it in the first place?
@alimahdili3752
so finally i could learn "self" OOP in python Thx sooo muchh <3
@mikehadden7974
It was good until you added in the complexity of installing packages to deal with csv files and then attempting to use those packages. It didn't seem necessary or particularly relevant to oop. Granted, I'm not that experienced, but then I probably wouldn't be watching the video if I was. For someone who is attempting to grasp oop, that was an unnecessary tangent that ultimately drove me away.
@Programming_Learning-k2y
Doubts :
1) 1:07:04
@zakariya-w8w
00:04 Understanding object oriented programming is important for software developers.
07:57 Creating a method to calculate the total price of items
23:21 Understanding constructors and best practices in classes
31:11 Learned about constructor and working with different attributes
45:44 Using a for loop, we can print the names of all instances
53:38 Read CSV file and instantiate objects with class method.
1:09:32 Create a separate class named 'Phone' that inherits from the 'Item' class
1:17:02 Inheritance allows creating child classes that inherit attributes and methods from parent classes.
1:31:54 Create read-only attributes in Python using the property decorator
1:39:20 By adding double underscores to attribute names, access to those attributes is prevented outside of the class.
1:54:40 Encapsulation and abstraction principles are applied in object-oriented programming.
2:03:06 Inheritance allows code reuse across classes
@SavageRespect-vm3vt
If you guys get error with csv package, feel free to use pandas and in instantiate_from_csv class methods use the following code:
@classmethod
def instantiate_from_csv(cls):
csv_file_path = "Items.csv"
df = pd.read_csv(csv_file_path)
data_dict = df.to_dict(orient='records')
for item in data_dict:
Item(
name = item['name'],
price = item.get('price'),
quantity = item.get('quantity')
)
@hugobarrancopalma3388
Great tutorial! Does anybody know what color theme is he using??
@zhiqizhu8310
Everything I got little confused then he says "what that means? It means"….. and things were crystal clear!!
@seekhoaurkaro
I have following code and as mentioned in 26:48 I must receive an error of type mismatch but I'm not receiving that error message and if I call cal_total_price function it just print t 10 times
class Item:
def cal_total_price(self):
return self.quantity * self.price
#argumented constructor
def __init__(self,name:str,price:float,quantity:int):
self.name = name
self.price = price
self.quantity = quantity
item2 = Item("Laptop","t",10)
@LenCedeno
Would be nice if you could show how to inherit a value from a getter method in the super class by calling it in a child class
@naomizerfu6743
Thank you so much
@davidomoyeni8376
Can someone explain how that static method is_integer() works? I am finding it difficult to comprehend how that point zero is left out.
@littlevoid5259
I dont understand why there is no python icon in my vs code on the top right most corner and why there is no suggestion for extension for reading csv files in my vs code please help . i installed the CSV Rainbow extension but i dont have the option to see the data in the tabular form
@asyad1000
on 27:06, i typed name: str, and i still managed to insert an int or any other value. after some research, turns out these are considered a mere hints for some tools to pick to guide the user for the proper data type. but really you can't dictate user to use any certain data type except with *assert*. or at least that's what i found.
@evilpollination1916
Just finished this video.
Took me around 5 6 hours while coding everything myself, clearing my own small doubts, and testing the code.
Learned so much its amazing. Thanks freeCodeCamp and Jim for this amazing video
@mahdigh9287
as the one learning different things and trying different approaches all the time , I would say it was very informative and most importantly not boring and out of topic and also was concise
Thank you
@user-pq8qk6hy8d
Amazing lecture and very engaging
@sisisisi6
By far the best EXPLANATION of OOP concert I’ve watched, and I’ve watched a few. Thank you so much!
@hoangvuminh6436
my opinion, you guys should learn OOP with java or C++ to fully understand
@DTDSHEFF
if you see this comment. Please stop search python class course, this video is already all you need to know
@dhyutidharabandooni4830
One of the BEST python tutorials i have ever seen. Most just show you the code and expect you to understand it but in this video he explains EVERYTHING thank you so much, i have learned a ton about python because of you!
@quanghuynh2021
Very informative. Thanks a lot.
@sivajyothichandra
Really it was a great video. Learnt more with magic methods _repr_
@kvelez
class Framework:
def __init__(self, name: str, version: str) -> None:
self.__name = name
self.__version = version
@property
def name(self) -> str:
return self.__name
@name.setter
def name(self, name: str) -> None:
self.__name = name
@property
def version(self) -> str:
return self.__version
@version.setter
def version(self, version: str) -> None:
self.__version = version
dotnet = Framework(".NET", "9.0")
print(dotnet.name)
print(dotnet.version)
dotnet.name = ".NET Framework"
print(dotnet.name)
dotnet.version = "4.8"
print(dotnet.version)
@CodeMastersChannel
Helpfull for any level
@msigaming-im7ru
Such a great and informative tutorial. I think you guys should posted a separate video especially in python for data structures and algorithm
@robertantony4877
thanks for creating such a great video guys i really like it