In the last part of STATIC VARIABLE - 2:10:10 Thing have changed now due to future update in PYTHON (04/07/2024) - now it does not throw any error Explaination :- Error in Older Versions: If you encountered errors when calling methods through instances in older versions, it might have been due to improper handling of method types before the @staticmethod decorator was introduced. No Error in Modern Python: In modern Python versions (Python 3.x), calling static methods through instances works seamlessly because Python recognizes and resolves the call appropriately, avoiding any unexpected arguments being passed. WE CAN NOW USE BOTH WAYS : - Calling Static Methods Static methods can be called in two ways: 1. Through the class: ClassName.methodName() 2. Through an instance: instance.methodName() 1. Atm.get_counter() 2. c1 = Atm() c1.get_counter() Hope this help any person in future who is studying this concept
Your Python tutorials are an absolute masterpiece! Your passion, clarity, and dedication make learning Python an incredible experience. Thank you for being an extraordinary teacher.Love from Pakistan
49:05-->50:50 Accessing class attributes and we can also create the from outside the class 57:35-->59:00 Reference variable 1:45:25-->1:47:30 What is encapsulation
Great lecture sir..watched it twice already. Can't thank you enough. one correction at 2:10:51 , after adding @staticmethod keyword before get_counter method, you can access the get_counter() method by creating the object of the class. ie. c1 = Atm() ---> c1.get_counter() will work now as mentioned at 2:10:09 now it will not throw error.
Jaha PNA tusi great ho sir great explanation and I really understand oops concepts I had tired to seeing so many videos of oops but you're the one actually jise smjne m asani Hui thanks sir j.
Hello Sir! first of i would like to appreciate your efforts you put to teach us, this is really awesome. I am following your playlist of Ml and Deep learning also, but sometimes i need to revise past things, which is a tough task for me , because i cannot write everything in my notebook, because it take a lot of time, so sir can you pls upload all the notebooks of Onenote of ML and Deep Learning playlists....
Key Take aways from this lecture: 1) BYJUs wale... I also hate them 2) p=q (reference variable wla concept) 3) harami junior ka "hehehe" 4) getter & setter 5) Static method (@decorator)
Today is Sunday and I just watched a movie and after watching it I just wanted to revise my oops in python and I saw this video trust me encapsulation wale part me me Jo hasa hu, mujhe jo maza aya is far better than that 2.5hrs movie 😂😂😂❤❤
# Function to find if lines intersect each other def does_lines_intersect(line_1,line_2): """ ============================================================================= Function does_lines_intersect is used to find if 2 lines intersect each other Accepts -> First line object AND Second line object Returns -> Print statement ============================================================================= """ # Checking if both object belong to appropriate class if (not isinstance(line_1,Line)) or (not isinstance(line_2,Line)): return print("Please provide 2 line object")
def lines_intersection(line1, line2): if -(line1.A/line1.B) != -(line2.A/line2.B): return "two lines intersect" else: return "two lines don't intersect" l1.lines_intersection(l2) # the first argument 'line1' of line_intersection function by default goes to l1 object and second argument 'line2' goes to L2 object. # if m1 is equal to m2, the two lines will not intersect # m1 = - A1/B1, m2= -A2/B2
1:12:17 sir pr maine toh suna tha ki strings are immutable..... sir mutable vo hote hai jinn me hum existing input me changes kr sake or immutable vo jinn me hum small changes nahi kr sakte existing input me toh seedha new input bnana padta.
CORRECTED CODE: (as above code is not reliable for lines like x=3 and x=4) def line_intersect(line,line1): m1,m2 = "slope1","slope2" if line.B == 0 and line1.B == 0: return "given lines are parallel" elif line.B!=0 and line1.B!=0: m1 = line.A / line.B m2 = line1.A / line1.B if m1 == m2: return "given lines are parallel" else: return "given lines do intersect" else : return "given lines do intersect" because in coordinate geometry, lines are either parallel or intersecting
def exist_on_line(self,A,B,C): Line = self.A + self.B + self.C if Line == 0: return "exist on line " else: return "not exist on same line " is this approach correct
I see., So in term of oop an immutable object is an object in which no modification can be done. But if do so an entirely different object will be created in the memory.
While running the code on Google colab the connection interrupts again and again . I tried it on Jyputer notebook as well there kernel is dead is showing while running the oop code
Firstly, Iwan tto thank you Sir a million times. because Python mere liye tough this but now after your lectures its really fun and understandable. I have got a doubt at 1:07:23 class Person:
I have a question at time stamp 49: 50 minute. We want to access a non existing attribute gender of class. The rror we get is 'Person' object has no attribute 'gender'. We know that Person is the class ,but in the error it is showing it an a object, can you please explain why? Here Per
def lines_intersection(line1, line2): if -(line1.A/line1.B) != -(line2.A/line2.B): return "two lines intersect" else: return "two lines don't intersect" l1.lines_intersection(l2) # the first argument 'line1' of line_intersection function by default goes to l1 object and second argument 'line2' goes to L2 object. # if m1 is equal to m2, the two lines will not intersect # m1 = - A1/B1, m2= -A2/B2
sir, I have an Doubt. what if I want to create an instance variable name "__account__holder_name" as a private data then if i used like these "self.____account_holder_name" --> it does not prodcues any error ??? becuase the variable name contained the double underscore and when I using it with self.__ then it beome four time underscore then it will produce an error ????? anyone ??
@1:00:34 why function greet(person) has person with lower case not in PascalCase? but the program executes as expected. So I am confused about it. If anyone could help me clear doubts, that would be great. Thanks
I got it. I was confused as the parameter and our class name was same. the parameter in greet is just the name and it could have been any name. Sir, user person so that we would know that the object coming is type
code for fix the pritning issue of line eqution // class Line: def __init__(self, A, B, C): self.A = A self.B = B self.C = C def __str__(self): Ax = "" By = "" Cc = ""
if "-" in str(self.A): Ax = "-{}x".format(self.A) else: Ax = "{}x".format(self.A) if "-" in str(self.B): By = "-{}y".format(self.B) else: By = "+{}y".format(self.B) if "-" in str(self.C): Cc = "-{}".format(self.C) else: Cc = "+{}".format(self.C) return "{} {} {}".format(Ax, By, Cc)
class Line: def __init__(self, A, B, C): self.A = A self.B = B self.C = C def __str__(self): Ax = "" By = "" Cc = "" if self.A < 0: Ax = "-{}x".format(abs(self.A)) else: Ax = "{}x".format(self.A) if self.B < 0: By = "-{}y".format(abs(self.B)) else: By = "+{}y".format(self.B) if self.C < 0: Cc = "-{}".format(abs(self.C)) else: Cc = "+{}".format(self.C) return "{} {} {}".format(Ax, By, Cc)
Best teacher ......I have never seen such a hard working teacher like you .......salute you sir .....lots of love
In the last part of STATIC VARIABLE - 2:10:10
Thing have changed now due to future update in PYTHON (04/07/2024)
- now it does not throw any error
Explaination :-
Error in Older Versions: If you encountered errors when calling methods through instances in older versions, it might have been due to improper handling of method types before the @staticmethod decorator was introduced.
No Error in Modern Python: In modern Python versions (Python 3.x), calling static methods through instances works seamlessly because Python recognizes and resolves the call appropriately, avoiding any unexpected arguments being passed.
WE CAN NOW USE BOTH WAYS : -
Calling Static Methods
Static methods can be called in two ways:
1. Through the class: ClassName.methodName()
2. Through an instance: instance.methodName()
1. Atm.get_counter()
2.
c1 = Atm()
c1.get_counter()
Hope this help any person in future who is studying this concept
The way you explain from zero is just extraordinary 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏From today onwards you are my guru
You are doing a great charity work here. The values you are creating are much bigger than what anyone can think. Thank you, Guru Ji.🙏🙏🙏
Its my first time getting this excited after being taught by someone..."INCREDIBLE hattts of to you sir" youre doing a greatest work appreciate a lot
Your Python tutorials are an absolute masterpiece! Your passion, clarity, and dedication make learning Python an incredible experience. Thank you for being an extraordinary teacher.Love from Pakistan
Sir ji maza aagya junior -senior wali story se samajh kr ❤
Sir aap Bhagwan ho, if we will have many teachers like, the country will change. Many many thanks to you for such Data Science Playlist 🙏🙏🙏🙏🙏
no one can explain better than you sir!💯 you nailed it sir🙌👏 thank you sooo much 😇❤
Nitish sir you are truly a god level teacher .. Salute to you
49:05-->50:50 Accessing class attributes and we can also create the from outside the class
57:35-->59:00 Reference variable
1:45:25-->1:47:30 What is encapsulation
Great session as always Thanku sir
College me Paisa bhar ke ..sab Paisa barbaad 😢😢........kitna achha sikhate hai sir 😊....
Great lecture sir..watched it twice already. Can't thank you enough.
one correction at 2:10:51 , after adding @staticmethod keyword before get_counter method, you can access the get_counter() method by creating the object of the class.
ie. c1 = Atm() ---> c1.get_counter() will work now as mentioned at 2:10:09 now it will not throw error.
wow! here I getting every things with better understanding
Nitish Sir Aap great ho... Aaj tak aapke jaise teacher nhi dekha !!
Jaha PNA tusi great ho sir great explanation and I really understand oops concepts I had tired to seeing so many videos of oops but you're the one actually jise smjne m asani Hui thanks sir j.
Thank you Sir .. Awesome way of teaching through story the concept of encapsulation
Hi... 🙌🏻🌝
Thank you sir for the deep Explanation with funny example about Encapsulation.
Super se uper ... Lucid explanation ❤
Hello Sir! first of i would like to appreciate your efforts you put to teach us, this is really awesome. I am following your playlist of Ml and Deep learning also, but sometimes i need to revise past things, which is a tough task for me , because i cannot write everything in my notebook, because it take a lot of time, so sir can you pls upload all the notebooks of Onenote of ML and Deep Learning playlists....
Koti koti naman aapko🙏🏻🙏🏻❤❤
nice expalined encapsulation topic with why
Key Take aways from this lecture:
1) BYJUs wale... I also hate them
2) p=q (reference variable wla concept)
3) harami junior ka "hehehe"
4) getter & setter
5) Static method (@decorator)
Today is Sunday and I just watched a movie and after watching it I just wanted to revise my oops in python and I saw this video trust me encapsulation wale part me me Jo hasa hu, mujhe jo maza aya is far better than that 2.5hrs movie 😂😂😂❤❤
# Function to find if lines intersect each other
def does_lines_intersect(line_1,line_2):
"""
=============================================================================
Function does_lines_intersect is used to find if 2 lines intersect each other
Accepts -> First line object AND Second line object
Returns -> Print statement
=============================================================================
"""
# Checking if both object belong to appropriate class
if (not isinstance(line_1,Line)) or (not isinstance(line_2,Line)): return print("Please provide 2 line object")
# Formula ->
try:
a1, b1, c1 = line_1.A, line_1.B, line_1.C
a2, b2, c2 = line_2.A, line_2.B, line_2.C
Numerator = ((b1 * c2) - (b2 * c1)) / ((a1 * b2) - (a2 * b1))
Denominator = ((a2 * c1) - (a1 * c2)) / ((a1 * b2) - (a2 * b1))
except ZeroDivisionError:
return print("Lines don't intersect")
return print("Lines intersect at -> ",Point(Numerator , Denominator))
def lines_intersection(line1, line2):
if -(line1.A/line1.B) != -(line2.A/line2.B):
return "two lines intersect"
else:
return "two lines don't intersect"
l1.lines_intersection(l2)
# the first argument 'line1' of line_intersection function by default goes to l1 object and second argument 'line2' goes to L2 object.
# if m1 is equal to m2, the two lines will not intersect
# m1 = - A1/B1, m2= -A2/B2
really really insightful video I have ever seen!
What a explanation sir ji😮😮 hats off ❤❤❤❤❤❤❤❤
Best Teacher
GOAT
Static variables are only scoped till the execution of the program so static is also technically sometimes not that useful.
Best explanation and thanks for all your efforts 🙏
1:12:17 sir pr maine toh suna tha ki strings are immutable..... sir mutable vo hote hai jinn me hum existing input me changes kr sake or immutable vo jinn me hum small changes nahi kr sakte existing input me toh seedha new input bnana padta.
if any senior programmer will see this video then junior programmer and junior programmer's 'hehehe' will be the nightmare after watching this video
best video on entire youtube
"METHOD FOR LINE INTERSECTION"
def line_intersect(line,line1):
m1 = line.A/line.B
m2 = line1.A/line1.B
if m1 == m2:
return("given lines are parallel")
x_int = (line.B*line1.C - line1.B*line.C)/(line.A*line1.B - line1.A*line.B)
y_int = (line1.A*line.C - line.A*line1.C)/(line.A*line1.B - line1.A*line.B)
p = Point(x_int,y_int)
if line.shortest_distance(p)==0 and line1.shortest_distance(p)==0 :
return("given lines do intersect")
else :
return("given lines do not intersect")
CORRECTED CODE:
(as above code is not reliable for lines like x=3 and x=4)
def line_intersect(line,line1):
m1,m2 = "slope1","slope2"
if line.B == 0 and line1.B == 0:
return "given lines are parallel"
elif line.B!=0 and line1.B!=0:
m1 = line.A / line.B
m2 = line1.A / line1.B
if m1 == m2:
return "given lines are parallel"
else:
return "given lines do intersect"
else :
return "given lines do intersect"
because in coordinate geometry, lines are either parallel or intersecting
def exist_on_line(self,A,B,C):
Line = self.A + self.B + self.C
if Line == 0:
return "exist on line "
else:
return "not exist on same line "
is this approach correct
Awesome explaination
thnx uh sir to make this video free
Great teacher......
CAN'T BELIEVE THIS IS FREE
Implementation of Abstraction is known as Encapsulation.
great story❤🔥
what if the line equation has rhs value other than zero?how to generalise then?timestamp ~33mins
01:38:30 Nothing is private in Python. Python is made for mature programmers. Feature ❌ Excuse ✅
Great Sir, Thankyou.
king of ds
I see.,
So in term of oop an immutable object is an object in which no modification can be done.
But if do so an entirely different object will be created in the memory.
Very well explained sir.
You are very Amazing
another masterpiece💥💥
world class coaching
quality content
I am looking for an answer or hint of second problem of Task (the deck card problem), where do i found the solution?
yahi hot hai diff aur sab youtuber me aur ki aap real life company ka scenario bata pata ho
private wala bahut sai tha
love u sir :)
Best ever ...
best teacher 😍
You are the besttttttttttttttttttttt
great
While running the code on Google colab the connection interrupts again and again . I tried it on Jyputer notebook as well there kernel is dead is showing while running the oop code
Bhaiya mujhe sirf aapki hi class samjh aati hai but aapne to sessions paid kr rkkhe hai afford nhi kr skta mei but
Firstly, Iwan tto thank you Sir a million times. because Python mere liye tough this but now after your lectures its really fun and understandable.
I have got a doubt at 1:07:23
class Person:
def __init__(self,name, gender):
self.name=name
self.gender=gender
def greet(person):
person.name = 'ankit'
print(person.name)
p=Person('xyz','male')
greet(p)
print(p.name)
but when global keyword example me
def h(y):
global x
x+=1
x=5
h(x)
print(x)
it was not allowing !!!! please explain
01:14:00 restart
Thankyou sir
Maja aa gya sir 😁
Thank you so much
I have a question at time stamp 49: 50 minute. We want to access a non existing attribute gender of class. The rror we get is 'Person' object has no attribute 'gender'. We know that Person is the class ,but in the error it is showing it an a object, can you please explain why?
Here Per
What happened if it will write obj.get_balance() = 'hehehe' 1:46:09
def intersection_point(line, other):
if (line.A * other.B - other.A * line.B) != 0:
x = round((line.B * other.C - other.B * line.C) / (line.A * other.B - other.A * line.B))
y = round((other.A * line.C - line.A * other.C) / (line.A * other.B - other.A * line.B))
return "The given lines intersect at Point({},{})".format(x,y)
else:
return "The given lines does not intersect each other"
def lines_intersection(line1, line2):
if -(line1.A/line1.B) != -(line2.A/line2.B):
return "two lines intersect"
else:
return "two lines don't intersect"
l1.lines_intersection(l2)
# the first argument 'line1' of line_intersection function by default goes to l1 object and second argument 'line2' goes to L2 object.
# if m1 is equal to m2, the two lines will not intersect
# m1 = - A1/B1, m2= -A2/B2
24:45 sir hume 4th scenario k liye line class kyu bnani padi method nahi bna sakte the?
🥰😊Thank you
sir how I add multiple fractions. can you help me, please
Use *args
1:29 - sir you just tell the amount, at first we need to check the pin
Dimag jyada lagate ho janab
java vs python story was best
that's why companies are not hiring freshers 😅
thnk u mera naam use krne ke liye
sir, I have an Doubt.
what if I want to create an instance variable name "__account__holder_name" as a private data then if i used like these "self.____account_holder_name" --> it does not prodcues any error ??? becuase the variable name contained the double underscore and when I using it with self.__ then it beome four time underscore then it will produce an error ????? anyone ??
1:39:01 esa bhi kya chhupana jo, chah ke bhi nhi chhup rha😂
@1:00:34 why function greet(person) has person with lower case not in PascalCase? but the program executes as expected. So I am confused about it. If anyone could help me clear doubts, that would be great. Thanks
I got it. I was confused as the parameter and our class name was same. the parameter in greet is just the name and it could have been any name. Sir, user person so that we would know that the object coming is type
code for fix the pritning issue of line eqution //
class Line:
def __init__(self, A, B, C):
self.A = A
self.B = B
self.C = C
def __str__(self):
Ax = ""
By = ""
Cc = ""
if "-" in str(self.A):
Ax = "-{}x".format(self.A)
else:
Ax = "{}x".format(self.A)
if "-" in str(self.B):
By = "-{}y".format(self.B)
else:
By = "+{}y".format(self.B)
if "-" in str(self.C):
Cc = "-{}".format(self.C)
else:
Cc = "+{}".format(self.C)
return "{} {} {}".format(Ax, By, Cc)
class Line:
def __init__(self, A, B, C):
self.A = A
self.B = B
self.C = C
def __str__(self):
Ax = ""
By = ""
Cc = ""
if self.A < 0:
Ax = "-{}x".format(abs(self.A))
else:
Ax = "{}x".format(self.A)
if self.B < 0:
By = "-{}y".format(abs(self.B))
else:
By = "+{}y".format(self.B)
if self.C < 0:
Cc = "-{}".format(abs(self.C))
else:
Cc = "+{}".format(self.C)
return "{} {} {}".format(Ax, By, Cc)
17/140
any one know ? that why sir dislikes ByJu's😅😅😅
sir roasted byjus
Sir kya hua Byju's naam aate hai aap ka mood chng ho jata hai
1:12:00 sir mujhe ye concept clear nahi hua....
🔥🔥🔥
sir i am unable to open your website
learnwith.campusx.in
sir how to access doubt support
Check membership tab. We have shared a google form there. You can fill the doubt there. Our team will contact you over email
How to join this full course
learnwith.campusx.in
What his website?