0% found this document useful (0 votes)
1 views3 pages

Basic Programming Concepts

The document provides an overview of Object-Oriented Programming (OOP), explaining key concepts such as objects, classes, and the four pillars of OOP: inheritance, encapsulation, polymorphism, and abstraction. It discusses how Python supports OOP alongside procedural programming, and outlines basic programming concepts including syntax, keywords, identifiers, data types, and variables. Additionally, it highlights Python's dynamic typing and provides examples of variable creation and usage.

Uploaded by

Saurabh Gupte
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views3 pages

Basic Programming Concepts

The document provides an overview of Object-Oriented Programming (OOP), explaining key concepts such as objects, classes, and the four pillars of OOP: inheritance, encapsulation, polymorphism, and abstraction. It discusses how Python supports OOP alongside procedural programming, and outlines basic programming concepts including syntax, keywords, identifiers, data types, and variables. Additionally, it highlights Python's dynamic typing and provides examples of variable creation and usage.

Uploaded by

Saurabh Gupte
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

• Object Oriented Programming:

The word object-oriented is the combination of two words i.e. object and oriented. The dictionary meaning
of the object is an article or entity that exists in the real world. The meaning of oriented is interested in a
particular kind of thing or entity. In layman's terms, it is a programming pattern that rounds around an object
or entity are called object-oriented programming.
Ref Video Link: [Link]
• Examples Of Object-Oriented Programming Language: Java, Python, C++, C#
• Object:
Any entity that has state and behavior is known as an object. For example, a chair, pen, table, keyboard, bike,
etc. It can be physical or logical.
An Object can be defined as an instance of a class. An object contains an address and takes up some space in
memory. Objects can communicate without knowing the details of each other's data or code. The only
necessary thing is the type of message accepted and the type of response returned by the objects.
Example: A dog is an object because it has states like color, name, breed, etc. as well as behaviors like
wagging the tail, barking, eating, etc.

• Class:
Collection of objects is called class. It is a logical entity.
A class can also be defined as a blueprint from which you can create an individual object. Class doesn't
consume any space.
• Four Pillers of Object-Oriented Programming Language: Inheritance, Encapsulation,
Polymorphism, Abstraction
• Inheritance:
When one object acquires all the properties and behaviors of a parent object, it is known as inheritance. It
provides code reusability. It is used to achieve runtime polymorphism.
• Polymorphism:
If one task is performed in different ways, it is known as polymorphism. For example: to convince the
customer differently, to draw something, for example, shape, triangle, rectangle, etc.
In Java, we use method overloading and method overriding to achieve polymorphism.
Another example can be to speak something; for example, a cat speaks meow, dog barks woof, etc.
• Encapsulation:
Binding (or wrapping) code and data together into a single unit are known as encapsulation. For example, a
capsule, it is wrapped with different medicines.
A java class is the example of encapsulation. Java bean is the fully encapsulated class because all the data
members are private here.
• Abstraction:
Hiding internal details and showing functionality is known as abstraction. For example, phone call, we don't
know the internal processing.
In Java, we use abstract class and interface to achieve abstraction.
• Why Python is Object Oriented:
Python support both Object Oriented and Procedural Programming language as it is a high level
programming language designed for general purpose programming. Python are multi-paradigm, you can
write programs or libraries that are largely procedural, object-oriented, or functional in all of these
languages. It depends on what you mean by functional. Python does have some features of a functional
language.
OOP's concepts like, Classes, Encapsulation, Polymorphism, Inheritance etc. in Python makes it as a object
oriented programming language.
In Similar way we can created procedural program through python using loops, for, while etc. ..and control
structure

• Syntax:
When referring to a programming language, the syntax is a set of rules for grammar and spelling. In other
words, it means using character structures that a computer can interpret. For example, if a user tries to
execute a command without proper syntax, the compiler finds this error and generates a syntax error, usually
causing the program to fail.

• Keyword:
A keyword is a word that is reserved by a program because that word has a special meaning, typically
a commands or parameters. Keywords are used in many different languages, but they all have similar functions
and purposes. They help programmers write code more efficiently by allowing them to use words instead of
having to spell out every single command.

• Identifiers:
Ref link: [Link]
identifier#:~:text=Python%20Identifiers,differentiate%20one%20entity%20from%20another.

• Data Type:
Python has five standard data types, but this programming language does not make use of any keyword
to specify a particular data type, rather Python is intelligent enough to understand a given data type
automatically.

• Numbers
• String
• List
• Tuple
• Dictionary
Here, Number specifies all types of numbers including decimal numbers and string represents a sequence
of characters with a length of 1 or more characters. For now, let's proceed with these two data types and
skip List, Tuple, and Dictionary, which are advanced data types in Python.

• Variable
Variables are the names you give to computer memory locations which are used to store values in a computer
program.
For example, assume you want to store two values 10 and 20 in your program and at a later stage, you want to
use these two values. Let's see how you will do it. Here are the following three simple steps −
• Create variables with appropriate names.
• Store your values in those two variables.
• Retrieve and use the stored values from the variables

Following is the equivalent program written in Python. This program will create two variables a and b and at the
same time, assign 10 and 20 in those variables.
Python does not want you to specify the data type at the time of variable creation and there is no need to create
variables in advance.
a = 10
b = 20
print "Value of a = ", a
print "Value of b = ", b
print "Value of a = ", a, " and value of b = ", b
When the above program is executed, it produces the following result −
Value of a = 10
Value of b = 20
Value of a = 10 and value of b = 20

You might also like