Transcripts
1. Python course introduction: Welcome everyone to
the complete course of Python programming language. This course consists of
two different modules. In the first model, we are
going to discuss about the concepts of complete
Python introduction. And also, we are
going to discuss about the concepts
like variables, data types, loops, conditional
statements, and functions. In the second module, we are going to discuss about object oriented
programming in Python. We're going to discuss
about how to create class and object in Python. And also, we are going
to discuss about the concepts like inheritance, polymorphisms, abstracts,
and encapsulation. So this course is very, very, very useful for the
students who are trying to learn Python programming
language for the first time. So let's get started.
2. Python class 1 : History of Python: Welcome everyone to
the first class. In today's class,
we're going to discuss a good complete
introduction to Python. So Python is a high level
programming language, and also Python is an object oriented
programming language. So we can use Python for
a variety of applications like missile lining
applications, web development applications. So Python was created by Guido and rosam, a Dutch programmer. So he named Python after
the BBC Comedy TV series, Monty Python Flying Sacs. So Python was develop
in the year 1980s, and we are using the Python
three version from the 2008. So that's the main
history of Python. After that, we are going to discuss about the
differences between the compiler and interpreter because Python is an
interpreter language. For that, only we need to know the differences between
compiler and interpreter. For the first compiler, read whole program at a time. Interpreter, read
program line by line. So that's the main difference between compiler
and interpreter. Compiler, read whole
program at a time. Interpreter read line by line. And the second difference is, the compiler translates
the whole program into the missing code. But in interpreter,
it translates one by one line of program
into missing code. After that, the
compiler produces the machine code which directly understood
by the computer. But in the case of interpreter, it produces only the
intermediate code. It does not produce
any misine code for the computer
to be understood. After that, the compiler takes more amount of time to
analyze the source code, because compiler translates
the whole program into the misin code. But in the interpreter, it takes less amount
of time because the interpreter reachs
the line one by one. So after that, the
compiler is faster, and the interpreter is slower because it
translates whole program, it translates one by one. And also the compiler requires more amount
of memory space. But interpreter requires
less amount of space. Also, the programming
languages like C and C plus plus uses compiler. And the programming
languages like Python and Ruby uses
the interpreter. So that's the main difference between compiler
and interpreter. So after that, we
are going to need the diachromatic representation of compiler and interpreter. First, we're going to
talk about compiler, how the compiler works for the languages like
C and C plus plus. So first, the source code of the programming languages
like C and Sleepls plus will be compiled by the compiler and translates into the
misin code directly. And then we produce the output for our
programming language. So that's the working
of the compiler. It translates the source code directly into the misine code. So after that, we're going to
talk about the interpreter. First, interpreter source code, will be translated
into byte codes. So that's the
intermediate instruction of the interpreter. So after the byte codes is translated to Python
virtual machine. After that, only, we get
output for our project. So that's the working
of the interpreter. Interpreter translates
the source code into the intermediate code only, not directly into
the machine code. So that's the main difference. The compiler directly converts the source code into
the machine code. So after that, we're
going to discuss about the applications
of Python, the first one step
web development. So you know the frameworks
like Jago and Flask, we can use that framework
for our project. And the second isa data analysis and visualization
for visualization, the Python libraries like
N Pi Pandas and Matt Plat. And the third application is machine learning and
artificial intelligence. For the machine
learning libraries like tensor flow
and ski skit learn, so we're going to need these libraries for our
machine learning projects. And the fourth application
is scientific computing. For the scientific computing
like physics and astronomy, biology are numerical
mathematical functions. We are going to need
the Python libraries for executing that
scientific computing. So these are all
the applications we can use Python language. After that, we are going to discuss about what
are all the IDs available for Python for executing the code
of the Python. For the first one will
be the Py charm, very, very useful for
Python programming, mission learning projects and also deep learning projects. And the second Oester
Visual Studio code, most of them developers using
the Visual Studio code. You can also use VS code
for Python language. And the third Oester
Jupiter notebook, we are going to need
the Jupiter notebook for our upcoming classes. So these are all the IDs available for
Python environment. You can also search for other softwares which are execute the Python
programming language. Atlas, we're going to discuss about the advantages
of the Python. So the first tone
is the readability. So human can understand and also Mine can understand the
programming language of Python. So that's the main advantage of readability because the
Python language is very, very, very easy and
easy to understand. So synthax is very,
very, very easy. Even the beginners can
understand Python language. So that's the use of Python
and the second onsta cality. Vesality is nothing, but
the Python can be run in all platforms like
Windows, Mac or Linux. So that's the city and the third ones large
standard libraries, because in missing learning, most of the libraries are
present in Python language. For that, only, we are using Python for missing
learning applications. And the last advantage is
cross platform compatibility. So it also same as the cality because it can run in all
platforms like Windows, Mac OS, and Linux. So these are all the
advantages of Python. So in the upcoming class, we are going to discuss about how to install the Python and how to install the
IDEs Python language. So let's see on the next class.
3. Python class 2 : IDE for Python: Welcome, everyone.
In today's class, we are going to discuss
about how to install Python. For that, you have to
open the Google Chrome, and then you have to type
the Python 3.11 download. You can also download
any other version. I'm going to download
Python 3.11 0.8. So you have to scroll down. You have to check whether
your PC is 64 bit or 32 bit. So my PC is 64 bit, you have to select that option. After that, you can see your
Python file is downloading. So you have to wait for that. After that, you
have to open that. So you have to select
the two options. So you have to check
the path of the file. My path of the file
is C and uses. And then you have to
sell it, install now. So you have to wait for the setup progress to be completed. After the completion
of installation, you have to select close. And then you have to open
the path of the file. So you have to open the
program inside the users, you have to select your folder, and then you have to select
app data inside the local, you have to select, and then you have to search for programs. In that, you can see the Python. So you can see all the versions of Python previously installed. So you have to copy the
path of this Python file. So you have to copy that. So then you to select
your PC and properties. After that, you have to
search for advanced settings. Advanced PC settings,
our system settings. You have to select that, and then you have to select
environment variables. So in the user variables path, already your Python 3.11 ers is already added in that
environment variable. So you don't have to add again. So you have to add in
the system variables. So you have to
search for the path of the system variables, and then you have to select new. After that, you have to copy and paste the path of the file. And then you have to select K K, and then After that, you have to open
the command prompt. You have to open that.
Then you have to type the command
for Python version. You have to select enter. We can see the default Python
version for your computer. My default Python
version is 3.7. After that, we are going
to discuss about how to download and install
the Python IDEs. For the first, we are going to install the Pi charm IDE for Python for that type
Pycharm community edition. We have to download
the community Edson because it is free for
all developers of Python. So that's why we are using
the Pih community download. So you have to open the website. So you don't have to download the Pi harm
professional version, so it is not free. So it is only free
for 30 days for that, you have to scroll down, and then you have to download the Pile harm community edition. And then you have
to select download. So you have to wait for
the download process. After the download is completed, you have to install the
Pi charm for your Python. The process of installation of Pi charm is very,
very, very easy. You have to select next
next nest, Atlas install. So after the installation
is completed, you have to open the
Pi charm in your desk. So we have completed
the process of how to download and install Pi
charm for our Python. After that, we're going
to discuss about how to create a new project
in the Pycharm. For that you have
to select the file, in that you can see
new project option, you have to select that And then you have to type
the project name, and then you have to select
the location of the project. After that, you have to select
the version of the Python, so you can also select
any one of them. I'm going to choose
Python three Pine nine. That's it. That's the process of creating a new project
in the Pycharm. After that, we are going
to discuss about how to create a Python file
in the Pycharm. You have to right click
the Python folder, and then you have to
select new Python file. In that, you have to type
the Python file name. You can type your own words, and then you have to
select the Python file. That's it, we have created the Python five in the Pycharm. I have to type the code for the Python to execute
in the Pycharm. I'm going to type the
first program in Pycharm. I'm going to print How world, you have to type
print How world. Then you have to
select run option. So you can see
your Python output is executed successfully. So you can see how world
is executed successfully. That's the step far executing
the Python in the Pycharm. After that, we are going
to discuss about the second IDE far
executing the Python. The second ID will be
Visual Studio Code. We have to download and
install Visual Studio Code, and then you have to open the Visual Studio
code from your deskt. The process of download and
installation is very simple. After that you have to create a new file in that
to type Python, to type Python, you
have to select that. You can see a new Python file is created in the
Visual Studio code. After that to save
your Python file, you have to save us, you have to type the
Python file name program, and then you have
to sell it save. We can also install Python from the Visual Studio code for
that to open the extension. In the extension,
you to type Python. You can see the first option, you have to download that, and then you have to
install the option. You can also install Python from the Visual Studio
Code. That's it. We have created the
new Python file in the ist Studio Code. We are going to type
our first program in the Visual Studio Code. I'm going to print
again the Holler world. And then you have to save
your program control, and then you have to
right click and run code. So on the right hand side, you can see the Halo
world as executed successfully in the
terminal of the VS Code. That's, we are completed the second IDE for
executing the Python. So that's the VS Studio Code. After that, we're
going to discuss about the last IDE for
running the Python. For that, I'm going to use
this IDE for my course, for that to open the Google, and then to tie Google Cap. We're going to use Google
Colab for running our Python. We have to select
the Google Cap. So Google Colab is host
the Jupiter Notebook. It is one of the type of
the Jupiter notebook. Also, Google Cap provides
free access to GPU and CPU. So that's the most important
future of Google Colab. If your computer does
not have any GPU or CPU, most of the computer have CPU, but most of the computer don't
have GPU for that To open the Google Colab for executing the missile learning
projects, which requires GPU. So after opening the new
notebook in the Google Colab, you have to type your
project file name. So in that, you have to type
your project file name. After that, you have to
change the run time. So you have to
select Python three. And then you have to select
any one of the option, whether it is GPU or CPU. If your project is
missile ing model, required GPU, you have
to select T four GPU. If your project is normal one, you have to sell CPU. So for my project, it is a very simple one. F that only, I'm
going to select CPU. In the Google collap you can
see there are two options, the first Desta code for
writing the code for your Python language and
the second Desta text. If you want to type any text, you can also use
the text option. You have to select the title, and then you have
to select bolt, and then you have
to select text. If you want to delete any cell, you have to select delete
option in the Google Colab. We are going to type our first
program in Google Colab. F that, we are going
to type print H World. We have to run that. You can see our output is exaluted successfully
in the Google Cap. The main important future
of Google Colab is, it consists of free GPU
and TPU for our project. In the upcoming
class, we're going to discuss about
variable key words, data types, and other
functions in the Python. Let's see you in the next class.
4. Python class 3 : Variables: Welcome everyone to
the third class. In today's class, we're going to discuss about
variables in Python. So variable is nothing but a container that stores
the values of the data. So it's like a memory that
stores the data values. So that's the
meaning of variable. It is a container that
stores the data values. And also, we are going to use the equal sign for
assigning the variables. So that's the second line. And the third line, the
syntax for variable is to type variable name equal to
and then variable value. And then you can see the
two examples for variables. The first one is
the A equal to ten. A is a variable that
sows the value ten. And the second
name equal to Ron. Name is a variable that
stores the value ron. In Python, the most
important feature is you don't have to specify the data type for the variables. The Python automatically assigns data type for the variable. So that's the most important
feature of Python. Variable is nothing but is ano container that stores
the values of the data. After that, we are
going to discuss about the rules for
creating variables. So the first rule for
creating the variable is variable name must contain let us numbers and
underscores only. It does not start with number. And the second rule for creating the variable is the variable
must be meaningful one. Also, the variable
must not be keywords. The keywords like if
else then are far il, so these are all the keywords. Keywords cannot be
used as variable name. The most important
rule for creating the Python variable is
Python is case sensitive. You have to remember
the upper case and lower case variable because
both are different variables. There are some examples
for valid variables. The first one is the
name equal to RAM. And the second is the user
underscore name equal to RAM. And the third is the
name two equal to RAM. You have to remember that variable cannot start
with the number. So to open the Google Cola, we are going to
discuss about how to create variables in Python. For that, I'm going to
type A equal to ten. A will be the variable, which is to the value ten. After that, we're going to
create the second variable. Student underscore name. We can use underscore for
creating the variable. So you can type your name. We're going to create a
third variable student two equal to. You have to type other name. These three are valid examples for creating the
variables in Python. You have to print the values. For that, you have
to type print of A and then print
of student name. You have to type student
underscore name. Also, you have to type
print of student two. You have to remember that variable cannot
start with number. You have to run the code
for printing the output. In today's class, we
are discussed about how to create
variables in Python. In the upcoming
class, we're going to discuss about
keywords in Python. Let's see on the next class.
5. Python class 4 : Keyword: Come, everyone.
In today's class, we're going to discuss
about keywords in Python. Python has some
reserved keywords. That is already defined
keywords in Python libraries. We cannot use keywords
as variable names. So the keywords like if else far while def written import
class to false ne. These are the examples
for keywords. We cannot use keywords
as variable name. So that's the most
important rule. We cannot use keywords
for variable name. So keywords isn't already
defined words in Python. Also keywords are
case institute. You have to remember the
uppercase and lower case, for the creating
keywords in Python. After that, we're going
to discuss about how to find what are all
the keywords in Python. For that we're going
to discuss an example. Again, you have to
open the Google Cap. We are going to discuss
about how to find what are all the keywords
present in Python. For that, you have to
type this cod port, and then you have
to type keyword. After that, you have to
type print for displaying, what are all the keywords
present in the Python. You have to type keyword that KW list KW is
nothing but keyword. We have to run. So these are all the keywords
present in Python. Like if import is lamda, not rise finally except Aleaf break avid
A sync S T falls, none and not def. So these are all the
keywords present in Python. So keywords are nothing but
reserved words in Python. We cannot use keyword
for variable names. If you try to run this, so we can see the error for creating the keyword
as variable name. For that, only, you
have to remember that we cannot use keyword
as variable name.
6. Python Class 5 : Datatype: Welcome, everyone.
In today's class, we're going to discuss
about data types and type casting in Python. First, we are going
to discuss about what are all the data types
available in Python? So you have to type
A equal to ten. A equal to ten is nothing
but integer data type. After that, we're
going to discuss about the second data type. We have to type B equal to 20.7. So 20.7 is nothing
but float data type. Point values are nothing
but float data type. After that, we're going to
discuss about third data type, that is string data type. So C equal to How. Hallow isn't string data type. You can also type
sentence or paragraph. It will be considered as string. And then we are going
to discuss about fourth Data type D equal to. True. Whether the true or false are the same data
type of Boolean data type. So true and false is one of the type of Boolean data type. After that, we're
going to discuss about fifth data
type, e equal to. We're going to discuss
about list data type. So you have to type square
bracket inside that, you have to type the values. We are going to discuss the
list in the upcoming classes. After that, we are
going to discuss about tuple data type, for that to type f
equal to open bracket, for list, it is square bracket, for tuple, it is open bracket. Inside that to type
your own values. This is the syntax for
creating the tuple Data type. And then we are going to
discuss about other data type, that is dionary data type. For Dionary data type, we are going to type g equal to. We have to type curly brackets, for string, you to
type quotation. For integer data type, you don't have to
type quotation. A equal to ten. For dictionary data type, it is one of the key
and value pairs. We are going to
discuss about what is key and value pair in
the upcoming class. These are all the data
types available in Python. Other data types also available in Python
like set or other. If you want to find the
data type of a variable, you have to use
the type function. You have to type type of A. If I run this output
source Tata type. If you don't know how to find the data
type of the variable, you have to use type function. So if I type, it will be
son as string data type, I I type D, it will be
s as Ban data type. A list data type. F. Tuple data type, and G. Last one, G diionary data type. If you want to find
the data type, you have to use type function. After that, we're
going to discuss about typecasting in Python. Typecasting is nothing
but we are going to convert one data type
to another data type. For example, we are
going to convert T data type to float data type. We have to type the code for
converting the data type. We have to type A equal to. Float of B. I have to type the data type, whatever you want to convert, we are going to convert
integer to float for that to type float inside that
to type the variable. That is A. A contains
integer data type. We're going to convert the
A into float data type. So I'm going to print A, and also I'm going
to find the type of A. I'm going to find
the Data type of A. If I run this, If
I run this code, so we can see the
integer data type is converted to float data
type by adding 0.0. So the point values are
shown as float data type. For that only adds 0.0 for converting
the integer to float. Also, we can see the data
type as float data type. That's the way to convert the one data type to
another data type. If I want to convert the float data type again
into integer data type, you to type in.
And then to print. So you can see the
float data type is converted to
integer data type. So after that, we are going to discuss about the
second example. We are going to convert the list data type
to Tuple data type. For that to type, the data type, so to type tuple. We are going to convert
List two tuple. So the list theta
type is E variable. For that, only, we
are going to convert the E variable to tuple. You can see the
square bracket is converted to open bracket. Square bracket is for the
list open bracket is for the t. We can also convert each Deta type to another theta type
in your free tang.
7. Python class 6 : id function: Come, everyone.
In today's class, we're going to discuss about
ID function in Python. So ID function is
very, very useful for. If we want to find the
address of a value, we have to use ID function. For that, we are going
to see an example, we are going to create a
variable A equal to ten. So we're going to find the
address of the value ten. That is A equal to ten. For that you have to print ID of A So if you print the value, we can see the
memory location of the value that is
A equal to ten. So in that position, our value A equal
to ten is stored. So if you want to find
the address of the value, you have to use ID function. Also, we are going to
create an other variable. We are going to find whether the same value have the
same address location. So we have to t A equal to ten, and then we are going to print
the address of the value. You have to print
ID of capital A. So you can see the two values have the same memory location. So the value, so the value ten, have the same memory location. Whether the variable can be
uppercase or lower case, the value ten has the
same address location.
8. Python class 7 : Arithmetic operator: Come, everyone.
In today's class, we're going to discuss about arithmetic operators in Python. Arithmetic operators like
Addison suraxN multiplation, DVs floor division and modulus. These are all the types
of arithmetic operators. We are going to
discuss one by one. For the first, we're going
to create a variable for our example Aqual to
ten and B equal to 20. First, we're going
to perform addition. For that, we're going
to print the value directly for that A
two type A plus B. That's the addition operator. T and then we are going to
create subtraction A minus b. Subtraction. Then
we are going to print multipation, A into B. So you have to remember the
uppercase and lower case because Python is
case institute. You have to type multiply. After that, we are going
to print division, for that autotyp, A, divide b. Then we're going to discuss
about floor division, for that auto type, A double ss B. So what's the difference between division
and floor division? So I division, the output
sours point value. In floor division, the
output so whole value. So that's the main difference between division
and floor division. So for example, in division, the output so 10.5. So in the floor division, the output so ten. So I division output
sos the otient value. In modulus, the output
source remainder value. So that's the difference
between division and modulus. So we're going to run the core. In the output, you can
see a plus b a minus b, a multiply b a divide b a double divide
b and a modular b. You can also see
the division 0.5. In the floor
division, it is zero. That's the difference between floor division and division. Also in division
0.5, in modulus, it is ten because division
output sos the quotient value. In modulus, the output so
remind the value. So that's it. In today's class, we
are discussed about arithmetic operators in Python. So in the upcoming class, we're going to discuss about
logical operators in Python. So let's see in the next class.
9. Python class 8 : Comparison operator: Welcome, everyone.
In today's class, we're going to discuss about comparison operators in Python. So there are many comparison
operators in Python. We are going to
discuss one by one. For that, we're going to discuss an example A equal to
ten and b equal to 20. So after that, we're
going to first perform the equal to operator. A equal to B. So that's the first
comparison operator equal. And then we're going to print the second comparison
operator A not equal to A. That's the second comparison
operator, not equal. And then third operator, that is a greater than B. That is the third operator
greater than and then fourth, A less than B. Less than, and then fifth, fifth will be a greater
than equal to be, greater than equal to
b, greater than equal. Last, A, than equal to b. These are all the comparison
operators in Python. The first toe is the equal, and the second done
is the naught equal, and the third is
the greater than, and the four is an f
is greater than equal, and the last toe is
less than equal. You have to change the first
option because I type, you have to type
equal and equal. After that to run the ode, you can see the Bollen
values of output. A equal to equal to b, no, A is ten b is 20 t.
These are not equal. And then a not equal to b, true, because they
are not equal, A greater than B false, because B is greater, A less than B, true, because A is less than B, and then a greater
than equal to false, and then A less than
or equal to b, true. These are all the comparison
operators in Python. You have to remember
equal equal. By type wrong, you have to
change that. That's it. In today's class,
we are discussed about comparison operators. In the upcoming class,
we're going to discuss about bit is operator in Python.
10. Python class 9 : Logical operator: Welcome, everyone.
In today's class, we're going to discuss about
logical operators in Python. There are three logical
operators in Python and are not. We are going to
discuss one by one, and for that we're
going to discuss an example A equal to ten, and then we're going to print. First, we're going to
discuss the operation. For that A type, a greater than ten, and A less than 20. Undergical operator, the
two condition must satisfy. If 81 condition
does not satisfy, the output serves the
Boolean value false. So if two conditions
are satisfied, the output serves the
Boolean value true. So that's the meaning
of unogical operators. So the output serves Boolean
values like true or false. If I run this, the output saves false because two conditions
must be satisfied. If I change that A equal to ten, output source true because the two conditions
are satisfied. That's the use of
ungical operator. After that, we are
going to discuss about logical operator. The meaning of r condition is any one condition
must be satisfied. If anyone is satisfied, the output source true. If both condition does not
satisfy output source false. If I run this code, so you can see true because
one cotan is satisfied. A less than 20 is satisfied. If I change the
code and run this, A greater than ten and a greater than 22 condition
does not satisfied. Oput source falls. In r, any one condition
must be satisfied. At last, we're going
to discuss about last logical operator.
That is not. If your value is true, output source falls, if your value is false,
output source true. That's the use of
nought condition. We have to take not
In that output, a greater than ten. Satisfy a less than 20. But the output shows false
because our value is true, but in the noth condition, it changes the value
from true to false. If your condition is false,
output source proof. So that's the difference
between and not. In today's class,
we are discussed about logical
operators in Python. In the upcoming class,
we're going to discuss about comparison
operator in Python.
11. Python class 10 : Bitwise operator: However, everyone,
in today's class, we're going to discuss about
bitwise operator in Python. For that, we're going
to discuss about what are all the bitwise
operators in Python. There are many bitwise
operators in Python and R not X R left sift
and right shift. So these are all the types of bitwise operators in Python. We are going to discuss only and not X R. For finding
the bitwise operator, you have to remember the sum. So you have to remember the sum for finding the
bits of the Python. First, we are going to
discuss an example, A qu 22 and b23. We are going to find
LCM two and three, and also we are going
to find bit far two and bit far
three using the LCM. F that, I'm going
to use the paint. We have to remember the
LCM two, 12 is two. The remainder is zero. The bit f two is 10. You have to write from
left to two right. 10 is the bit f two. After that, we are going to find the LCM three. To type three. We are going to
use the 12 is two. The remainder three
is one After that, we are finding the bit for
three a one and 1f210, because the remainder is zero. F three, the remainder is one. So that's why the
bit far three is 11. And then two f one and zero. So we're find the bit f two
and three using the LCM. So I'm going to show you another
example finding the bit. I'm going to use ten. I'm going to use 5210, the remainder is zero. And then I'm going to
use two table again. I'm going to use 224. The remainder will be one, and then 12 is two, the remainder is zero, from to type from left
to right, to type. F ten, the bit value
will be 10 and 10. To type. Remember the remainder. The bit for ten is 10, 10. So LCM can be used to find
the bit for the value. That's it, we are finding
the bit f two and three, and also we are discussed
the third example ten. The bit f two is 10, and the bit f three is 11. After that, we're
going to create a bit wise operator one by one. First, we're going
to discuss about for the n d to use the
symbol and B A and B. That's the symbol for
bitwise operator, and So n concept is
very, very same. The two values
must be satisfied. In the Bitwise operator, the two values must be true. For that, zero is
considered as false. One is considered as true
in Bitwise operator. So we have to remember
zero is far false. One is far true. F, the both condition
must be true. That is the both
value must be one. In the output, we can see two, I'm going to show you how
the two comes in the output. For the bit of two, 10, for the three, the bit
will be 111 and one. We are going to find
so zero is false. So zero is false, and one is true. If any one is false, the output will be false and
If both conditions are true, the output will be true. So the output source 10. The 10 bit is nothing but two. That's why output source two. So you can remember that zero is far falls,
one is far true. And then we are going to
discuss about r operator. So r is the same concept. An one is true, the output will be true. So we can see the
output source three. We are going to discuss how
the t comes in the output. We have to erase all the values. In condition, anyone is
true, output is true. O, anyone is true, output will be true. 01, 01 is nothing but three. That's why output shows three. And then we're going to discuss
about naught condition. We have to type the
symbol for naught. The symbol for naught, you have to remember the symbol. Not condition shows
the negative value. So I can see minus three, negative value minus three. After that, we are going to
discuss about XR condition. F that you have to remember
the symbol for x R, we have to type cap function, A B. F the condition are
concept for X R is nothing, but same value
comes, it is zero. Different value, it is one. Example like one and one, the output source zero. Zero and one are different. Oput source one. That's the concept for x
r. If I run this code, you can see one, I'm going to discuss how the one
comes in the output. So the bit far to The
bit two, and three, using the LCM, one,
zero, and one, one, F x r, different values one,
output will be one. Same value, zero,
different value, one, same value, zero, zero, one, the bit will be one. If you take CM one, it becomes zero and one. Now to remember the concept, same value comes zero, different value comes one. Also, you have to remember the symbol for
bitwise operators. That's it in today's class, we are discussed about not X R condensing bitwise operator. For the finding the bits, you to remember the LC.
12. Python class 11 : Membership Operator: Come, everyone.
In today's class, we're going to discuss about membership operators in Python. There are two membership
operator in and not in. We are going to
discuss an example for membership operator, have to type and list. You have to remember the
syntax for creating the list. The syntax will be
square bracket. And then we are going
to discuss about the first membership operator in we are going to find whether the ten value is
present in the list or not. For that, only in
operator is used, and also we are going to
discuss about not in condition. The first condition shows that whether ten value is
present in the list or not. And then the second condition, we are showing that ten is
not present in the list. The output sources
boolean values, whether the value present
in the list, it ss true. If the value is not present in the If the value is not present in the
list, it sows false. So I have to run
that the first value true because ten is
present in the list. So that's why it serves true for false because the ten value
is present in the list. We are showing that ten is
not present in the list. So that's why it sows false. So that's the use of
membership operators, whether the value is
present in the list or not. If I type any other variable or any other value
and run the code, you can see true because that value is not
present in the list. So that's it in today's class, we are discussed about
membership operators in Python. So in the upcoming class, we're going to discuss about identity operators in Python.
13. Python class 12 : Identity operator: However, everyone,
in today's class, we're going to discuss about identity operators in Python. There are two identity operators
in Python is and not a. We're going to discuss an
example for identity operators. You have to type A equal
to ten and B equal to. You have to type any other value t. And then c equal to A. Identity operator concept pas, the value have the
same address or not. Far that, in the previous class, we discussed about how
to find the address of the value by using
the ID operator. If the address are, the values will present in
the output source. So if the address are not same, the values in the
output source false. A equal to ten have different memory location and B equal to t have different
memory location. But a equal to C have
same memory location. Both having same
memory location. Only B have different
memory location. After that, we are
going to discuss about is identity operator, A is B, A and B memory location
are sa we are going to find whether two memories are same false because two memory
locations are different. That's why outputs so false. After that, A is C. We are going to find whether
the A memory location, C memory location are same. So output source true because
they are same location. They are having same location. That's why it's source true. And then we are going
to discuss about is not identity operator is not B We are showing that a memory location is different
from B memory location. Also, we are showing that a memory location is different
from C memory location. W output source prove
and output source false. C C A is not B so because both
having different location, and A is not C having false because they have
both memory same location. So that's the use of
identity operators, whether the value is
same or not same.
14. Python class 12 : if else: Come everyone. In today's class, we're going to discuss about conditional
statements in Python. There are three conditional
statements in Python, the first test if condition, and the second
doest F condition, and the third Oeste condition. We are going to
discuss an example for these conditional
statements. For that, we are going
to discuss an example, mark it Colt 51st, we're using the if condition. So that's the starting point of the conditional statement. You have to use
if for the first. And then we're
creating the condition that is more greater than 90. So that's the first condition. If the condition is satisfied, we are going to print A grade. If the mark greater than 90, it will be considered
as A grade. If the I condition
is not satisfied, we are going to create another conditional statement
that is AF. AF condition will be
marked less than 50. If that condition is satisfied, we are going to print B grade. If the grade is less than 50, it will be considered
as B grade. If two conditions
are not satisfied, we are going to print the last conditional
statement that is else. In the ls, you can
type your words, we are going to print fail. If two conditions
are not satisfied, the student Mr will be
considered as fail, so the Mr will be 50. The first, if condition
is Mark greater than 90, it will be generated as a grade. If that condition
is not satisfied, we are going to create
an Lf condition. Alif condition will be
marked less than 50. If the mark is less than 50, it will be considered
as B grade. So these two conditions
are not satisfied. The mark will be
considered as fail. So you have to run the core. So its sos fail, because the above two conditions
are not satisfied, because the mark is
not greater than 90, and also the mark is
not less than 50. The mark is equal to 50. That's why the two conditions
are not satisfied, so the als condition sos fail. That's the use of conditional
statements in Python. If we have any conditions, we are going to
check one by one. For the one by one, there are three
conditions if f and else. In the next class, we
are going to discuss about far loop and
win loop in Python.
15. Python class 13 : While loop: However, one, in today's class, we're going to discuss
about loop in Python. In the previous class,
we are discussed about far loop and
range function. In today's class,
we're going to discuss about il loop with an example. First, you have to type
the variable that is I, that is the starting point. I equal to one. You have to type the starting
point, that is one. And then you have to type
the while loop while, and then you have to
type the condition, I less than ten. That is one less than ten. If the condition is satisfied, then only inside the
block of le is executed. You have to type your
le print function. Inside that you can type
how world or anything, I'm going to type even, and then you have
to type the tting, that is step value, I plus two. 22 values will be printed, even, even, even, even, even. If I type one, one, one, one, step will be printed one, even, one, even, one even. In the look, I equal to
one is the starting point. And then y you have to
check the condition. The condition is
I less than ten. The value of I is one, one, less than ten, the
condition is satisfied. And then we are going
to print the value. That is how world. We're going to print the value, and then we are going to
rate the value one by one. So that's the plus equal to one. Is whenever the
condition is satisfied, we are going to print
allow world one by one until the condition
is not satisfied. First, one less than ten, the condition is satisfied, I print allow, and then
I will be incremented. I equal to two, I becomes two, and then the condition
to less than ten. The condition is satisfied,
print allow world. And then I becomes three, less than ten,
condition is satisfied. Print allow world,
up to ten, ten, less than ten, that
condition is not satisfied. Then the output will be break. Then the output
exit from the loop. That's the use of wil loop. First, the starting point,
then the condecent, then you have to
type your own print, and then you have to
type the Iration. That is increment value. In upcoming class,
we're going to discuss about break and continuous
statement in Python.
16. Python class 14 : For loop: Welcome, everyone.
In today's class, we're going to discuss about far loop and range
function in Python. We have to type far, and then I will be
the rating variable. It will print one by one. N will be the syntax, and then you have to
type range function. Inside the range, you
have to type the range. We are going to print
first ten values. Using the far loop. That's the meaning
of range function. We are going to print
first ten values using the far loop. And then we're going to print I. So you to remember
the index concept, because in the index
concept, zero comes first. One does not comes first, you to remember,
zero comes first. Up to zero to nine, the value will be printed. So zero to nine will be
considered as ten values. If I run this code, you
can see zero to nine. You cannot see ten
because if the ten comes, it will be consider us in
the range of 11 values. That's the use of
range function. Also, you to remember
the index concept. Index starts from zero. If you want to print ten also, you to type 11. We can say zero to ten. The last value will be
considered as n minus one. 11 minus one, ten, ten values will be printed. But zero will be
considered as first index. After that, we're
going to discuss about other properties of Far loop. If we want to print the
starting value one, out to type one com
and then ending value. Ending value will be 11. In the output, you can
see, starting 1-10. So if you don't want to
print zero in the output, you have to type one comma n. So one is the starting point, Laven is the ending point. Also, you can type the
itrating value, that is two. So 22 values will be
itratd in the output. You can see one, and then
two values itratd, three, and then two values itrated, f, and then two values iterated, seven, and then two
values trated nine. So one is the starting point, Laven is the ending point, two is the rating value. Or step value. So two steps
are removed from the output. So that's the simple
flop in Python.
17. Python class 15 : Break continue: Welcome, everyone.
In today's class, we're going to
discuss about break and continuous
statements in Python. For the first, we are going to discuss about break condition, F that we are going to use le. So we have to type the
starting value I equal to one. And then you have to type
the while condition, and then you have to
type the condition I less ten are equal to ten. And then you to type print. We're going to print
the values of I. Whenever the condition
is satisfied, we are going to print
the value of I, and then we're going to increment
the I value one by one. So the starting
point, I will be one, and then condition I one
less than equal to ten, the condition is satisfied. And then we're going to
print the value of I. And then we're going to
increment the value of I whenever the
condition is satisfied. So you can see one,
two, three, four, five, six up to ten because our condition is ten less
than or equal to ten. So the condition is satisfied. That's why outputs ten values. So I'm going to discuss
about break statement. If I don't want to
print five, six, seven, eight, nine and ten, I'm going to use the
break statement. I only print one, two, three, and four. It does not print 56, seven, eight, nine, ten. For the break statement, we are going to use
the I condition. You have to take if If the value of I equal
to equal to five, then our condition
will be braked. If the value of I becomes five, then up to five, we are not going to
print Tower statement. So that's the use of break. It only prints one,
two, three, four. We're going to exit the
loop for break statement, you have to use the I condition. So we can see one, two, three, four, are printed
using the I condition. Whenever the I
comes i equal to i. The condition is satisfied, we are not going
to print the loop. That's the use of
break statement. It will exceed from the loop. And then we are going
to discuss about the second statement
that is continue. Continue is different
from break. Break does not print 5678 910, but continue does not print
only the number five. It will print 123-467-8910. Only Pi is not printed
in the output. So that's the use of continue. Continue, skip the element. Only skip P. Other
values are printed. Our ilk will be
skip the value i. If I run the score, you can
see Only one, two, three, four, and five will be skip
678910 will be printed. That's the difference between break and continuous statement. So break exceed the loop whenever the condition
is satisfied. C only skip the value when
the condition is satisfied. That's it. In today's class, we are discussed about
continue on break statement.
18. Python class 16 : String : However, in today's class, we're going to discuss about
string functions in Python. We are going to discuss about the Deta type string in Python. For that, we're going to create a string in the variable
name name equal to ron. And then we're going
to print the name. Also, we are going to print
the Data type of the name. So for finding the Data type, you have to use
the type function, and also we are going to find the memory location
of the string. If I run this code,
I can say on, and then class will be string, that is the data type, and then memory location
of the name Ron. Also, we are going
to discuss about how to get user defined input. For that you have to type
the variable gender, you can type your
own variable gender equal input of inside that to type the syntax inside that you have to type
the statement enter gender. So that's the syntax for
getting the user defined input. So I I run this code, you can see enter the gender, and then you have to
type the gender may. So that's the syntax for
creating the user defined input. So after that, we're going
to discuss about what are all the functions
available int. So we are going to discuss
the functions one by one. First, we are going to
discuss about the function, how to convert the lower case
variable into uppercase. P that we are going
to print inside that you to type the
variable name dt, and then to tie the function uppercase
upper f. In the output, you can see, the lower case
is changed to uppercase. So that's the first
function in stream, for changing the lower
case to uppercase. After that, we're going
to discuss about how to capitalize the first
word of the sentence, O string for that to use
the capitalized function. It will capitalize the
first word in the sentence. We have to run the code. So
you can see in the output, only the first letter
of the sentence, or string is uppercase. That is capitalize. So that's the use of
capitalized function. So after that, we
are going to discuss about the ad function count. So count is very,
very useful for. If you want to count the letter
or word in the sentence, how many times it is repeated
in the string or sentence. For that, we are going
to check count of Ron. So the count of Ron will be one. If I type n, how many times the n
letter is repeated. I can see two times two times the n character is
repeated in the string. We are going to replace the character word sentence
using the replace function. Inside that you have
to type the value, and then you have to
type the replace value. We are going to replace the
letter A to another letter. You can type your own letter
W. We are going to change a two W. So that's
the use of replace. You have to run the code. So can say A is changed to
two W. So after that, we are going to discuss about
slice function in string. So slice function is nothing, but we are going to
print the value from the one index position to
another index position. For the slice, you to
remember the index concept. In the string, the first
letter will be zero index. One, two, three and four. The A is the zero index, r is the one u is the second, n is the third, n is the four. We are going to print first
index to the last index. For that ototype, 124
We have to check. A is the zero, r is the one, u is the
two, n, three, four. We can see in the output, r u n. We have to remember that. The last value will
be considered as n minus one, four minus one. Three value will be
printed in the output. A is the zero index. If I want to print A
also to type zero. For slicing function, you to
remember the index position. We are going to discuss a
in the slicing function, how to reverse the
string for that to type, the code like in the square
bracket to type colon colon, and then minus one. It will reverse the
string from n to A. That's the use of
colon colon minus one. If you want to
reverse the string, you have to use that function. In the output, you
can see n n r A. It will reverse the string. After that, we're going to find the last function in
string that is length. If you want to find the
length of the variable, you have to use length function. The length will be pi, one, two, three, four, five. There are five characters
in the variable. That's the function of length. That's it in today's class, we discussed about string
and its functions. In the upcoming class, we're
going to discuss about the list data type and
also list functions.
19. Python class 17 : List : Hello, everyone.
In today's class, we're going to discuss about
list data type in Python. So I have to remember that list is an immutable data type. That is, we can change or delete or add new
value in the list. For that, we're going to
see an example how to create a list to type a equal to square bracket inside
that to type the values 2030 40 these are
all same data type. We can create same data
type using the list. Also, we can use homogeneous
and heterogeneous data type. Heterogeneous is nothing but different data
type in same list. We are going to see an example, ten, 20 p f, ten will be the integer, 24 will be the float, and Hallow will be
the string data type. It will be the
heterogeneous data type. First is the
homogeneous data type, and the second done is the
heterogeneous list data type. We can create same data type, also different list data type. That's the important
feature of list. I'm going to print
the value of A and B. We have to type print of A. Also, we have to print of B. I'm going to
find the type of A. Also, I'm going to find the type of I'm going to
print the ID of A. That is the memory
location of A. Also, I'm going to find
the memory location of B. If I run this code, I can see Ata type,
that is list, and then Beta type, also list, and then and then memory, memory location of A
and B are different. That's the way of
creating list in Python. After that, we're going
to discuss about what are all the functions
available in list. The list is mutable data type. That is, we can
change the value. For that, first, we
are going to discuss about how to change
the value in the list. We are going to change
the value from the list. We have to remember the
index concept also. We're going to change the
ten that is the zero index. We're going to change the value A square bracket inside that you have
to tie the index. We are going to change
the t equal to 30. We have to remember the index, and then we are going to
print the value of A. If I run the score,
you can see the value of index position
one t is changed to. Ten will be the zero index, will be the first
index. I changes to. After that, we're
going to discuss about the second function in list. If you don't know how to find the index position of a value, you have to use the
index position function. We have to type a dt index of inside that to
type the value. If you want to find the
index position of the value, you have to use the
index function. If I run this code,
you can see one. One will be the index
position of the value. After that, we are
going to discuss about the third
function in list. We are going to remove
the value from the list. For that auto type, et remove of ten. We are going to remove the
ten value from the list. We can say ten is
removed from the list. We have to remember that
list is a mutable data type. We can change the value, remove the value,
add new values also. After that, we're going to
discuss about how to add new value in the list for that you have to use
the function in set, and then you have to
type the position. Index position value. So index position will be zero, and the value will be ten. You remember in the
inset function, you have to type, index
position, and then value. You can see in the
index position zero, the ten will be added. First, we discussed about
how to change the value. Then second, we are discussed about how to remove the value. And then third, we are discussed about how to insert the value. After that, we are
going to discuss about how to combine two list. For that, we're going to create
a function called extend. We have to type a extend
second list, that is B. We are going to combine
A list by B list. After that, I'm
going to print A. Can say two list are combined. 1,020.5 and allow will
be added to the list A. This is the syntax for
combining the two list. After that, we're going to discuss about the
other function. We are going to sort the values, whether it is ascending
order or descending order, for that you are to use
the sorting function, and then you have to type
reverse equal to true. If the reverse it, it comes from lost value to first value. That's the reversing the lit. First, we are sorting the list, and then we are
reversing the list. We can see in the output, 40, 30, 30, and ten, are reversed. If you want to reverse the list, you have to use the
sorting function. And also, you have to type
reverse equal to two. In today's class,
we are discussed about list and functions. In the upcoming class,
we're going to discuss about and their functions.
20. Python class 19 : Tuple: Welcome, everyone.
In today's class, we're going to discuss
about tuple in Python. Tuple is an immutable data type. That is, we cannot change
the values in the tuple. But list is a mutable data type. We can change the value. So Far that, we are going to see an example for creating
the tu in Python. We have to type A
equal to open bracket. So that's the syntax for
creating the tuple, 2030 40. These are all the
same data type tuple. Like list, we can also
create same data type, that is homogeneous data type and also heterogeneous
data type. We can type integer, float, and string
also Halo world. It is the different data type. I tuple. I'm going to print
the values of A and B, print of A, and then
I'm going to print B. Also, I'm going to
find the type of A. The type will be tuple. After that, we're going
to discuss about what are all the functions
available in tuple. So there are less amount
of functions available in table because tuple
is an mutable data type. We cannot change, remove, add a new values in tuple. So that's why the functions
are less in tuple. Compare to list. We are going to see the first
function slicing function. Slicing function is
nothing but starting index position to
last index position, we are going to
print the values. Using the index concept. Now to remember.
022, to print 2030. Because two is n minus one, two minus one, one, then zero t index value and one index value will
be printed in the output. If you want to print
two index, also, you have to type
three, zero is three. So that's the use of
slicing function. You have to print
all the values. You have to type colon only. You don't have to type
the index position, starting position,
and ending position. If you want to print
all the values. That's the meaning
of slicing function. If you want to change
the values of the tuple, you have to convert the data
type from tuple to list. In the previous list, we are discussed about the type casting functions in Python. We have to convert to
list for that a type, a list of A, and then we are
going to print A. Also, I'm going to
check the type of A. Run this code. You can see open bracket, change to square bracket. Also tuple data type change
to two, list data type. From that, we can add,
change the values. Only way to change the
values is type of data type. I print, can see values
removed from the tu list. So that's it in today's class, we are discussed about how
to create a tuple in Python, and also we are
discussed about what are all the functions
available in Tuple. In the upcoming class,
we are going to discuss about dictionary
data type in Python.
21. Python class 18 : Dictionary: Welcome, everyone. In today's s, we're going to discuss
about diinary in Python. So dinary is a key
value pairs data type. So we're going to
discuss what is the key? What is the value
pair in dictionary. For that, we're going
to see an example. Also, you have to remember, dictionary is a
mutable data type. We can change the values. We have to type A equal
to curly brackets. That's the syntax for creating the dictionary for the string, you have to type the quotation, and then for the integer, you don't have to
type the quotation. So A will be the key. Ten will be the value. That's the key and value pair. B is the key. Run is the value. That's the key and
value pair in diionary. Before executing your command, you have to remember
that you have to type to separate
the key value pair. That's the current syntax
for creating the dictionary. You have to separate the
key value pair by putting. I can see dictionary, the type of dictionary, and also the values
key value pair. After that, we are
going to discuss about what are all the
functions in dictionary? First, we are going to print the keys present
in the dictionary. F that you have to
type a dot keys of If you type a keys off, what are all the
keys available in the dictionary will be
present in the output. The key is like A, B, C. That's all the keys
present in the dictionary. A, B and C are the keys. After that, I'm going
to show you how to print values from
the dictionary. In previous, we discussed
how to print keys. We're going to discuss
how to print values to take values of
if I run this code, You can say ten run 20.5. These are all the values
present in the output. If you want to
print both values, that is k and value pair, for that T type
the fun and items, for that to type at items of
it will print both k value. You can see the A will be A B C and the value
ten run and 20.5. These are all the
three functions, which to print keys
values and items. You have to remember that
dionary is a mutable data type, for that we can change the
values in the dictionary, for that I'm going to
change the value of k ten to another value. I'm going to change
the value 10-20. How to type the key
equal to value. You can see the values
are changed. See 20. Before that, it is
ten after it is 20. We can change the values
in the dictionary. After that, I'm going to show you how to update the values. After that, I'm going to show you how to update the diionary. That is, we're going to add new key value pair for that to type a update inside that to
type the curly bracketes, and then you have to
type the key that is E, and then you have to type
the value, that is that. You have to print
A. In the output, you can see that new key
value pair is added. Before that, there are
three key value pairs. After that, we are created four key value pairs. That's it. In today's class,
we are discussed about dictionary in Python, and also we are discussed
about the functions in Python.
22. Python class 19 : Exception Handling: Welcome, everyone.
In today's class, we're going to discuss about try pt finally block in Python. So these blocks will be
helpful for absence in Python. So there are a lot of absents in Python and other languages. So we're going to discuss
one example for Xsan. So the example will be
zero division Xsan. So for example, whenever
the value divides by zero, the output source
zero division error. For that, we're going
to discuss the example, for that, I'm going to create a equal to ten and
B equal to zero. And then I'm going
to divide A by B. That is the value
ten divides by zero. So the output will solve
an exception error. I'm going to solve the output. So you can see the zero
division error occurs. That is division by zero. We cannot divide the
value divides by zero. That's the exception, one
of the exception in Python. For solving the son, we are going to need
t b finally blocks. For that, first, we're
going to use the tri block, which tries the code
whenever the pn occurs. So we're going to use the tri block for that
zero division error. Inside the block of tri, you have to type the A divide b. After that, we're
going to use except. Except is very useful for what exception does
the output source? For our example, the exception
so zero division error. We are going to use the
except exception as E, and then we are going
to print the exception. I can see division by zero. But you cannot see the error
message shown in the output. For that, only we are
using the tri block. It does not source the error. And then pt block sours, what type of exception
will occur in the output? So that's the use
of try and except. At last, we are going to discuss
about the finally block. So finally, block, whenever
the exception occurs, it does not care about the ps. It prints our other values. So we are going to print
our own values ho world. It does not care about
whether the ps occur or not. So I can see division
by zero and then Halo. So these three blocks will be helpful for
btance in Byton.
23. Python class 20 : class & object: Allow everyone.
In today's class, we're going to discuss
about the concept of object oriented
programming in Python. First class, we're going to discuss about
classes and object, how to create a
class in Python and how to create object in Python. For that, you have
to type the class, that is the syntax or keyword. And then you have to
type the class name. You can type your
own class name. And then you are to put
colon to end the statement. So inside the class, you can type your
own variable names, or methods, or any other, or you can also type
the constructor. So I'm going to
type the variable. We are going to discuss
about simple class, how to create a simple
class in Python. I'm going to type the
variable name equal to ron, and age equal to 22. After that, I'm going to
print these two values. F that so far that you have
to type print of name, and then you have to print. You have to remember the
uppercase and lower case because Python is
case institute. After that, whenever
you create a class, you have to create object. After that, only your class will be executed in the output. So F that, you have
to create an object. So I'm going to type
object one equal to, and then you have to
type the class name. The class name will be student. That's the way of creating
class and object. Also you can call the variable
name using the object. You can type the object
name object one name. You can call your
variable name using the object because we are
created object for the class. In the output, you
can see the print of name and the print of age and the object
name. So that's the on. So Aaron will be the
variable name in the class, we are called using the
object. So that's it. In today's class, we are
discussed about how to create a simple class
and object in Python. So in the upcoming class, we are going to
discuss about how to create a simple method in class.
24. Python class 21 : Class method: Welcome, everyone.
In today's class, we're going to discuss about how to create a method in class. For that, we are
going to discuss an example for creating
a method in class. You have to type the same
keyword that is class, and then you have to
type the class name. You can type your
own class name, and then Colon inside the class, you have to type
the class method. For creating the method, you have to type the keyword. And then you have to type
your own method name. You can type your own method. For that, I'm going to
create a method Addison. Inside the block, you have to type the variable for addition, A to ten bqu to 20, and print of C R A to A plus b, and then you have to
print the c value. That's the simple way of
creating method in class. And then we have to create
object for the class. So we have to type the
object name equal to, and then you have to
type the class name. So class name will be mass of. Using the object, we can call
the method in the class, for that you have to
type the object name dot and then method. So addition of. By using this, we
can call the method, and then we are going
to print the values. Also, you have to remember
that whenever you create a method in
class in Python, you have to type self keyword. You have to remember that
whenever you create a method, you have to type self
inside the method. After that, only your
output will be executed. If you don't type self, the output will generate error. In other programming languages, you don't have to type self. But in Python
programming language, you have to type self.
25. Python class 22 : Inheritance: Welcome, everyone.
In today's class, we're going to discuss about
inheritance in Python. So inheritance is
one of the type of object oriented programming. The concept of
inheritance is nothing, but the child class will inherit the properties
of the parent class. So that's the most important
concept of inheritance. For that, we are going to
discuss an example how to create a single
inheritance in Python. For the single inheritance, you have to type the
parent class name, that is class, and then you have to type
the parent class name. For example, my parent
class name will be father, so it will be very easy
to teach for that only, the class name will be father. So inside the parent class, you have to create a method. For creating the method, you have to type
the def keyword. And then you have to
type the method name, the method name
will be property. So whenever you create a method, you have to remember that
you have to type self. Inside the property method, you have to type the variables
money equal to 10,000, and then land equal to. So the parent class
father having the money 10,000 and
land equal to 20. So these are all the properties
of the parent class. After that, we are going to create a child class for that, I'm going to type class son. Inside the son class, you have to type the
parent class name. So the parent class name
is nothing but father. So that's the way of
creating single inheritance. Inside the class, you have to
type the parent class name. So class father is
the parent class. Class son is the child class. So again, you have to create a function inside
the child class. We are going to
create a function. You have to type D, and then you have to
type the function. Child. Whenever you
create a function, you have to remember,
you have to type self. And then you have to
type the variable name. You can type your own
variable name equal to on, and then a will be 22 That's it. We have created the single
inheritance in Python. For that, you have to create an object for the child class. So you have to remember
in single inheritance, you have to create an
object for the child class. The child classes son Using the object of
the child class, you can call both
child class method and also parent class method. That's the most important
feature of single inheritance. With the help of one object, you can call both parent
class and child class. F that you to type the
object n and then you to type the parent
class method name. If you try to run this code, you can see both the output of the parent class
and the child class. In the R rule will be
the child class method, and then 10,000 will be the
parent class method value. The money is 10,000. It is from the property
of the parent. That's it, we are created
the single inheritans. After that, we are going to discuss about
multiple inheritans. For multiple inheritans, you
have to create two classes. First, we are going to create the parent class,
that is father, and then we are going to create the second parent class,
that will be the mother. We have to type class mother, and then you have to type the property of
the mother class, that is the parent class. Mother having the savings, and then you have to type self. Inside the savings method, you have to type the variables. Variable will be money. Money will be 3,000 30,000 and then we are
going to print the money. So we are created
two parent class. And then to inside
the child class, to type both parent class name. The first parent
class will be father and the second parent
class will be mother. The class inherits
both parent class, that is father and mother. Inside the bracket, you to
type both parent class. Father mother. After that you have to call the method of the parent class, that is mother, the
method will be savings. Using one object, we can call both parent class and
also child class. I have to run the code. So can see the methods
of child class on, and then 30,000 will be the
method of mother class, and then 10,000 will be
the method of father, that is the parent
class. That's it. In today's class, we are
discussed about how to create single inherits and
multiple hers in Python. In the upcoming class,
we're going to discuss about polymorphism
in Python. Oh,
26. Python class 23 : Polymorphism: Welcome, everyone.
In today's class, we are going to discuss about
polymorphism in Python. For the polymorphism,
there are two types. The first Dese method overriding and the second doestm
method overloading. We are going to discuss only the method
overriding polymorphism. So method overriding is nothing, but we can create child class and parent
class with the same method. By creating object
for the child class, we can override the method
of the parent class. So that's the concept
of method overriding. For that, we are going
to see an example, you have to create
a parent class. You have to type the class name. The class name of the parent. The class name will be mass. Inside that, you have to create a function or method,
the addition of. Whenever you create a function, you have to type self, and then you have to
type the variables. You can type your own variables. A equal to ten, B qu to 20, and also we are going
to print A plus B. So that's the parent class. After that, we are going
to create child class. So you can type your
own child class, whether it is basic
chemistry or any other. And then you have to type
the child class method. So the method name will be same. You have to type Addison. So the parent class
method is also adds. Child class method
is also Addison. That's the use of
method overriding. And then you have to
type the variables, so we can type other values
equal to ten equal to 40, and then we are going
to print a plus b. So we are created two
class parent class mass, child class physics, but two class having the
same method name. That is Addison. For the method overriding, first, you have to create an
object for the child class. So you have to type the
child class object. For the method overriding also, you have to inherit the
value of the parent. In the previous class, we had discussed about
single inheritance. Same you have to type
inside the bracket, you have to type the
parent class name. So the child class is physics, and the parent class is mass. After that, you have to create an object for the child class. I have to tie the object
equal to physics. That's the child class. Using the object of
the child class, we can override the method
of the parent class. If I try to call addition, the child class addition method will be executed in the output. The parent class method will
not execute in the output. So I can say 96. In the child class
method of Adesan A equal to 50 and Bqued to 46, when two variables are added, the value will be 96. So the child class method
is shown in the output, not the value of
parent class method. So value of the parent
class will be 30. That's the use of
method overriding. If you want to print the
parent class method, you have to create a new object. For that you have
to type the object, OB one equal to mass of, and then using that object, you can call the method. I can see the first
tone is the 30. Thy will be the output of
the parent class method, and the 96 will be the output
of the child class method. That's it, in today's class, we discussed about polymorphism in object oriented
programming in Python. In the upcoming
class, we're going to discuss about
abstraction in Python.
27. Python class 24 : Abstraction: Welcome, everyone.
In today's class, we're going to discuss about
abstraction in Python. Abstraction is one of the type of object oriented programming. So the concept of
abstraction is nothing, but the internal function of the method will be not
visible to the users. Only the outer function will
be visible to the users. So that's the most important
concept of abstraction. For the abstraction, you
have to impose the packages. For that, we're going to impose the package for
abstraction in Python. We have to type, import ABC. ABC is nothing but abstraction. In other languages,
you don't have to import the packages
for abstraction. In Python, you have to import the package
for abstraction. Then from the main package
of the abstraction, you have to import
the sub package ABC, capital ABC, and then you have to import the method of the abstraction. Abstract method. We are going to discuss an example for abstract and you have to create
an abstract class. You have to type the class name, class name can be
your own choice, student inside that 02, create an abstract, that is ABC. By using the ABC, the class will be called
a abstract class. After creating the
abstract class, so you have to create a method. And then you have to type the
method name method name can be Mr of whenever
you create method, you have to type self, and then you have to
type the variable names. Mr can be your own choice. A equal to 100. The A equal to 100 is
considered as grade. We have created the
abstract method and also abstract class. And then you have
to create an object for running the
method to type OB, O V the object, and then you to type student. So that's the abstract class, and then to type OB Mark. If you run the score,
you can see zero grade. You can see the method value
zero grade. That's it. We have created abstract sN in object oriented
programming Python. On the upcoming class,
we're going to discuss about encapsulation in Python.
28. Python class 25 : Encapsulation: Come everyone. We are
going to discuss about encapsulation in object
oriented Python language. So encapsulation is nothing but wrapping all the units
into a single unit. So that's the concept
of encapsulation. For example, if you see
a tablet or medicine, all the chemicals are
stored in one cell. So that's the meaning
of encapsulation. There are three types of access modifiers
in encapsulation. The first one is the public and the second is the private, and the third is the protected. We are going to
discuss one by one. For the first, we are going to discuss about how to create public access modifier
in encapsulation. For that, you have
to create a class, class can be your
own choice, college. Method can be your
own choice, more. Whenever you create method, you have to type self inside that you to
type the variables, Mark mark equal to 100. And then we are going to
print the value of mark. After that, you have to
create object for the class. You have to type object
equal to college of. And then you have to call the method of the class
using the object. You have to type t mark of. In the output, you can see 100. This is the example for
public access modifier. In public access modifier, everyone can change the
value of the mark variable. That's the disadvantage of
the public access modifier. For that, only, we are going to use the private access modifier. For that, we are going
to see an example how to create private
access modifier, and then you have
to type the method. Method will be ite of
self and then you have to type self dot
college N equal to. We have to type
the college name. That's the variable
college name. And then we are going to
create an object college of and then we are
going to print a value of the college name for that auto type object
dot college name. This is the example for
public access modifier. The college name can be
changed by other users. We are going to convert the college name
public access modifier to private access modifier. By doing that, no users can change the value
of college name. So the syntax for private access modifier
is double underscore. T. So if you type double underscore before
the variable name, it will be converted to public access modifier to
private access modifier. If I run this code, you can see the error
message is sold because it belongs
to only the class. No other classes are
outside the class, we cannot access the variable. So that's the use of
private access modifier. No one can change the value of the variable
outside the class. Even if you create an
object or any other, the outside will not execute. After that, we're
going to discuss about lost access modifier
in enacllation, that is protected
access modifier. The syntax for protected
access modifier is single underscore, for private double underscore, for protected,
single underscore, for public, no underscore. So I I remove one underscore
and try to run the code, you can see output
will be generated. The protected variable can
be access using the object, but private cannot be accessed. That's it, we are created. That's it, we are discussed
about hasulation in Python, and also we are discussed about three types of access
modifiers in hasation.
29. Python Project: Welcome, everyone.
In today's class, we're going to create
a mini project using the Python language. So our mini project will
be B A M calculation. So that is body mass
index calculation. We're going to create
the mini project using the Python language. For the BMI calculation, we're going to need
the two variables. That is weight and height. We are going to discuss
how to calculate BMI. For the first, we are going
to need the height variable. The height of the person
can be float data type. Inside that, you can
tie entire height. And then we are going
to need weight. Weight also float data type. You have to type float turf, input tu, and then you have
to type entire river weight. That's the use of
user defined input. After that, we are going
to calculate height. Equal to height equal
to height by 100. Then we are going to calculate
the BMI using the formula. The formula of BMI is nothing
but weight divided by height in Multipation
of height height. That's the formula of BM. You have to remember the
formula for BMI calculation. After that, we are going
to print the value of BMI. We have to type print of BMI. The BMI for the person using the formula weight
divided by height into height. And then we are going to use the conditional statements
based on the value of BMI. For that, we are going
to need if condition, BMI greater than zero. Also inside that we are
going to create another if, so that will be
considered as nested if, and then netotype, if BMI
less than or equal to 16, so the person will be not
healthy or under weight. They need to care
for their health. Also, they need to
increase their weight. If the value of BMI index
not satisfy the if, we are going to need f. Inside the ef, you have
to type the condition, BMI less ten are equal to 25. If the person equal to 25, they will be considered
as healthy person. You can type your own words, you are good, A you
you can type healthy. After that, if two conditions
are not satisfied, so the person may be
fat or overweight. They need to decrease
their weight. You can type overweight. That's it, we created our mini project using
the Python language. The mini project is nothing
but BMI calculation. The BMI calculation, you need height and
weight of the person. Also you to remember
the BMI formula. The formula will be weight
divided by g height. Then we're going to need the conditional statement for printing the conditions
like underweight, healthy and overweight,
based on the value of BMI. I have to run the
code, you have to type the weight and height. You can type your
height and weight. After that, you can see the
BMI calculation, 16.32. You can see the printed
value will be healthy. That's the BMI calculation
of the person. Also, we are going to
create another person BMI. You have to type the
height and weight. After that, you can see the
BMI calculation, 16.54. Also, they will be considered
as healthy person. That's it. We have created the mini project for
our Python language.