Posts

Showing posts from May, 2020

Networking related to videos

How Internet works: https://www.youtube.com/watch?v=x3c1ih2NJEg

Explain classes, __init__ and self in Python

So the first thing you need to know about classes is the difference between a class and an instance of a class. A class is like a blueprint, it tells you about some thing you want to make. An instance is the thing that gets made. For example, if you write up a blueprint for an airplane, the blueprint is like when you define a class. The airplanes that get made from that blueprint are like instances of a class. Defining a class looks like this: class Airplane: pass (Normally you would have some more code instead of  pass . I'll explain that later.) Now once you define a class you can create instances of a class like this,  Airplane() . For example, airplane1 = Airplane() airplane2 = Airplane() Here we created two instances of the Airplane class and put them in the variables  airplane1  and  airplane2 . The important thing here is that you can change  airplane1  without affecting  airplane2 . They're two separate instances. Oka...

Python Youtube Links.

Python Some important and good youtube links. ----------------------------------------------------------- Search for the below channels in youtube: -------------------------------------------------- .  Indian Pythonista . Aaron Jack

Python important things to know.

Object oriented programming: ------------------------------ >> In OOP class and objects are the main aspects. >> Collection of data and its functionality is nothing but an OBJECT. >> We can combine data and its functionality and we can wrap it inside something called as       OBJECT. What is Self: --------------- >> "self" helps in differentiate b.w Instance Variable and Local Variable. >> Instance variable is nothing but a variable which belongs to an object. >> self refers to the object of the class itself. . if x is not None and x . foo == 42 : >> This would not work correctly with the bitwise & operator because both sides would always be evaluated, giving AttributeError: 'NoneType' object has no attribute 'foo' . >> When you use the boolean and operator the second expression is not evaluated when the first is False. >> Similarly or does not evaluate the second argum...