SlideShare a Scribd company logo
Introduction of Python
Python3
1. Python laid its foundation in the late 1980s.
2. The implementation of Python was started in the December 1989 by Guido Van
Rossum at CWI in Netherland.
3. In February 1991, van Rossum published the code.
4. In 1994, Python 1.0 was released with new features like: lambda, map, filter, and
reduce.
5. Python 2.0 added new features like: list comprehensions, garbage collection
system was introduced in 2000.
6. On December 3, 2008, Python 3.0 (also called "Py3K") was released. It was
designed to rectify fundamental flaw of the language.
7. Python is influenced by the programming languages like ABC language and
Modula-3.
Why we need Python?
Python has top the charts in the recent years over other programming
languages like C, C++ and Java and is widely used by the programmers.
The software development companies prefer Python language because of its
versatile features and fewer programming codes.
The language has extensive support libraries and clean object-oriented designs
that increase two to tenfold of programmer’s productivity while using the
languages like Java, VB, Perl, C, C++ and C#.
The Python language has diversified application in the software development
companies such as in gaming, web frameworks and applications, language
development, prototyping, graphic design applications, etc.
It provides large standard libraries that include the areas like string operations,
Internet, web service tools, operating system interfaces and protocols.
Interactive Shell
The interactive shell is also interactive in the way that it stands between the
commands or actions and their execution. This means the Shell waits for commands
from the user, which it executes and returns the result of the execution. After this
the shell waits for the next input.
Applications of Python
GUI-Based Desktop Applications
Image Processing and Graphic Design Applications
Scientific and Computational Applications
Games
Web Frameworks and Web Applications
Enterprise and Business Applications
Operating Systems
Language Development
Prototyping
Advantages of Python Programming Language
Extensive Libraries
Python libraries contain code for various purposes like regular expressions,
documentation-generation, unit-testing, web browsers, threading, databases, CGI,
email, image manipulation, and more.
Extensible
Python can be extended to other languages. You can write some of your code in
languages like C++ or C. This comes in handy, especially in projects.
Improved Productivity
The language’s simplicity and extensive libraries render programmers more
productive than languages like Java and C++ do. Also, the fact that you need to
write less lets more get done.
IOT Opportunities
Since Python forms the basis of new platforms like Raspberry Pi, it finds the
future bright for Internet Of Things. This is a way to connect the language with
the real world.
Simple and Easy
When working with Java, you may have to create a class to print ‘Hello World’.
But in Python, just a print statement will do. It is also quite easy to learn,
understand, and code. This is why when people pick up Python, they have a
hard time adjusting to other more verbose languages like Java.
Readable
Because it is not such a verbose language, reading Python is much like reading
English. This is also why it is so easy to learn, understand, and code. It also
does not need curly braces to define blocks, and indentation is mandatory.
This further aids the readability of the code.
Object-Oriented
This language supports both the procedural and object-oriented programming
paradigms. While functions help us with code reusability, classes and objects
let us model the real world. A class allows the encapsulation of data and
functions into one.
Free and Open-Source
Python is freely available. But not only can you download python for free, but
you can also download its source code, make changes to it, and even
distribute it. It downloads with an extensive collection of libraries to help you
with your tasks.
Portable
When you code your project in a language like C++, you may need to make
some changes to it if you want to run it on another platform. But it isn’t the
same with Python. Here, you need to code only once, and you can run it
anywhere. This is called Write Once Run Anywhere (WORA). However, you
need to be careful enough not to include any system-dependent features.
Interpreted
Python is an interpreted language. Since statements are executed one by one,
debugging is easier than in compiled languages.
Disadvantages of Python Programming Language
Speed Limitations
We have seen that Python code is executed line by line. But since Python is
interpreted, it often results in slow execution. This, however, isn’t a problem
unless speed is a focal point for the project. In other words, unless high speed is a
requirement, the benefits offered by Python are enough to distract us from its
speed limitations.
Weak in Mobile Computing and Browsers
While it serves as an excellent server-side language, Python is much rarely seen on
the client-side. Besides that, it is rarely ever used to implement smartphone-based
applications.
Design Restrictions
As you know, Python is dynamically-typed. This means that you don’t need to
declare the type of variable while writing the code.
Underdeveloped Database Access Layers
Compared to more widely used technologies like JDBC (Java DataBase
Connectivity) and ODBC (Open DataBase Connectivity), Python’s database access
layers are a bit underdeveloped. Consequently, it is less often applied in huge
enterprises.
Interactive vs Normal Mode
Python has two basic modes normal and interactive mode. The normal mode is the
mode where the scripted and finished .py files are run in the Python interpreter.
Interactive mode is a command line shell which gives immediate feedback for each
statement, while running previously fed statements in active memory. As new lines
are fed into the interpreter, the fed program is evaluated both in part and in whole.
Python Character Set
A…….Z ASCII value 65 to 90
a……….z ASCII value 97 to 122
0……..9 ASCII value 48 to 57
Special Characters
Python Tokens
Each single unit which together combine to a statement is known as tokens.
Keywords
Python has a set of keywords that are reserved words that cannot be used as
variable names, function names, or any other identifiers. E.g. and, as, in etc.
Python Identifiers
An identifier is a name given to entities like class, functions, variables, etc. It
helps to differentiate one entity from another.
Rules for writing identifiers
Identifiers can be a combination of letters in lowercase (a to z) or uppercase (A to
Z) or digits (0 to 9) or an underscore _. Names like myClass, var_1 and
print_this_to_screen, all are valid example.
An identifier cannot start with a digit. 1variable is invalid, but variable1 is
perfectly fine.
Keywords cannot be used as identifiers.
We cannot use special symbols like !, @, #, $, % etc. in our identifier.
Identifier can be of any length.
Python is case sensitive
Python is a case-sensitive language. This means, sum and Sum are not the same.
Always name identifiers that make sense.
Python Literals
Literals can be defined as a data that is given in a variable or constant.
String literals "Arjun" , '12345'
Numeric literals 100, -26.2
Boolean literals True or False
Special literals None is used to specify to that field
that is not created.
Literal Collections Collections such as tuples, lists and
Dictionary are used in Python
Python support the following literals
Python Operators
Python language supports the following types of operators.
Arithmetic Operators
Comparison (Relational) Operators
Assignment Operators
Logical Operators
Bitwise Operators
Membership Operators
Identity Operators
Python Arithmetic Operators
Operator Example
+ Addition 10 + 20 = 30
- Subtraction 10 – 20 = -10
* Multiplication 10 * 20 = 200
/ Division 5/ 2 = 2.5
% Modulus 10 % 2 = 0
** Exponent 2**3 =8
// Integer Division 5//2 = 2
Python Comparison Operators
Operator Example
== (2== 3) is not true.
!= (2!= 3) is true.
<> (2<> 3) is true. This is similar to !=
operator.
> (2 > 3) is not true.
< (2 < 3) is true.
>= (2 >= 3) is not true.
<= (2 <= 3) is true.
Python Assignment Operators
Operator Example
= c = a + b assigns value of a + b into c
+= Add AND c += a is equivalent to c = c + a
-= Subtract AND c -= a is equivalent to c = c - a
*= Multiply AND c *= a is equivalent to c = c * a
/= Divide AND c /= a is equivalent to c = c / ac /= a
is equivalent to c = c / a
%= Modulus AND c %= a is equivalent to c = c % a
**= Exponent AND c **= a is equivalent to c = c ** a
//= Floor Division c //= a is equivalent to c = c // a
Python Bitwise Operators
Python Bitwise Operators
Operator Example
& Binary AND (a & b) (means 0000 1100)
| Binary OR (a | b) = 61 (means 0011 1101)
^ Binary XOR (a ^ b) = 49 (means 0011 0001)
~ Binary Ones
Complement
(~a ) = -61 (means 1100 0011 in 2's complement
form due to a signed binary number.
<< Binary Left Shift a << 2 = 240 (means 1111 0000)
>> Binary Right Shift a >> 2 = 15 (means 0000 1111)
Python Logical Operators
Python Logical Operators
Operator Example
and Logical AND (a and b) is true.
or Logical OR (a or b) is true.
not Logical NOT Not(a and b) is false.
Python Membership Operators
Operato
r
Example
in x in y, here in results in a 1 if x is a member of sequence
y.
not in x not in y, here not in results in a 1 if x is not a member
of sequence y.
Python Identity Operators
Operator Example
is x is y, here is results in 1 if id(x) equals id(y).
is not x is not y, here is not results in 1 if id(x) is not equal to id(y).
Python Operators Precedence
The following table lists all operators from highest precedence to lowest.
Precedence Operator
1 ** Exponent
2 ~ + - Complement, unary plus and minus
3 * / % // Multiply, divide, modulo and floor division
4 + - Addition and subtraction
5 >> << Right and left bitwise shift
6 & Bitwise 'AND'
7 ^ | Bitwise exclusive `OR' and regular `OR'
8 <= < > >= Comparison operators
9 <> == != Equality operators
10 = %= /= //= -= += *= **= Assignment operators
11 is is not Identity operators
12 in not in Membership operators
13 not or and Logical operators
Python Data Types
Python provides various standard data types that define the storage method on
each of them. The data types defined in Python are given below.
Numbers
String
List
Tuple
Dictionary
Numbers
Number stores numeric values. Python creates Number objects when a number
is assigned to a variable. For example
a = 3 , b = 5 a and b are number objects
Python supports 4 types of numeric data
int (signed integers like 10, 2, 29, etc.)
long (long integers used for a higher range of values like 908090800L, -
0x1929292L, etc.)
float (float is used to store floating point numbers like 1.9, 9.902, 15.2, etc.)
complex (complex numbers like 2.14j, 2.0 + 2.3j, etc.)
Strings
The string can be defined as the sequence of characters represented in the
quotation marks. In python, we can use single, double, or triple quotes to define a
string. String handling in python is a straightforward task since there are various
inbuilt functions and operators provided.
List
Lists are similar to arrays in C. However the list can contain data of different types.
The items stored in the list are separated with a comma (,) and enclosed within
square brackets [].
Tuple
A tuple is similar to the list in many ways. Like lists, tuples also contain the
collection of the items of different data types. The items of the tuple are separated
with a comma (,) and enclosed in parentheses ().
A tuple is a read-only data structure as we can't modify the size and value of the
items of a tuple.
Dictionary
Dictionary is an ordered set of a key-value pair of items. It is like an
associative array or a hash table where each key stores a specific value. Key
can hold any primitive data type whereas value is an arbitrary Python object.
The items in the dictionary are separated with the comma and enclosed in the
curly braces {}.
Mutable and Immutable Data Types in Python
Since everything in Python is an Object, every variable holds an object
instance. When an object is initiated, it is assigned a unique object id. Its type
is defined at runtime and once set can never change, however its state can be
changed if it is mutable. A mutable object can be changed after it is created,
and an immutable object can’t.
Mutable Data Types: int, float, bool, str, tuple
Immutable Data Types: list, set, dict
Thanks you
Contact Info
ZENUS INFOTECH INDIA PVT. LTD
Near Hotel Deep Residency, Ram Nagar Chowk
Roorkee - 247667(Uttrakhand)
Phone:01332-261250
Mobile:+91-8218088730
E-Mail:info@zenusinfotech.in

More Related Content

PPT
Introduction to python
PDF
Python programming
PDF
Introduction to python programming
PPTX
Python programming introduction
PPTX
Introduction to python
PDF
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PPTX
Python | What is Python | History of Python | Python Tutorial
PDF
Python Crash Course
Introduction to python
Python programming
Introduction to python programming
Python programming introduction
Introduction to python
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
Python | What is Python | History of Python | Python Tutorial
Python Crash Course

What's hot (20)

DOC
About python
PDF
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
PPTX
What is Python? An overview of Python for science.
PDF
Python quick guide1
PPTX
Python Introduction | JNTUA | R19 | UNIT 1
PPTX
Python - An Introduction
PPTX
Why Python?
PDF
PDF
Cs6660 compiler design
PDF
Cp week _2.
PPTX
Introduction to Python Basics Programming
PDF
Core python programming tutorial
PPTX
Python Programming
PDF
Fundamentals of python
PPTX
Programming
PDF
Web Programming UNIT VIII notes
PDF
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
PPTX
Getting Started with Python
About python
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
What is Python? An overview of Python for science.
Python quick guide1
Python Introduction | JNTUA | R19 | UNIT 1
Python - An Introduction
Why Python?
Cs6660 compiler design
Cp week _2.
Introduction to Python Basics Programming
Core python programming tutorial
Python Programming
Fundamentals of python
Programming
Web Programming UNIT VIII notes
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
Getting Started with Python
Ad

Similar to Introduction of Python (20)

PPTX
Python Introduction
PPTX
MODULE 1.pptx
PDF
introduction of python in data science
PPTX
Introduction-to-Python.pptx grade 9 ICT.
PDF
Intro-to-Python-Part-1-first-part-edition.pdf
PDF
20210517-PYTHON AI&DS PROGRAMMING NOTES.pdf
PDF
20210517-PYTHON AI&DS PROGRAMMING NOTES.pdf
PDF
PYTHON PROGRAMMING NOTES RKREDDY.pdf
PPTX
PPT_PYTHON Programming language High-level, interpreted
PDF
Python basic programing language for automation
PPTX
Welcome to python workshop
PPTX
python ppt | Python Course In Ghaziabad | Scode Network Institute
DOCX
PYTHON-Unit-I-Notes for python learnerss
PPTX
Python Programming-1.pptx of python by computer
PPTX
Python introduction towards data science
PDF
Pyhton-1a-Basics.pdf
PDF
First Steps in Python Programming
PPT
Learn python
PPTX
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
PPTX
Python Programming Language
Python Introduction
MODULE 1.pptx
introduction of python in data science
Introduction-to-Python.pptx grade 9 ICT.
Intro-to-Python-Part-1-first-part-edition.pdf
20210517-PYTHON AI&DS PROGRAMMING NOTES.pdf
20210517-PYTHON AI&DS PROGRAMMING NOTES.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdf
PPT_PYTHON Programming language High-level, interpreted
Python basic programing language for automation
Welcome to python workshop
python ppt | Python Course In Ghaziabad | Scode Network Institute
PYTHON-Unit-I-Notes for python learnerss
Python Programming-1.pptx of python by computer
Python introduction towards data science
Pyhton-1a-Basics.pdf
First Steps in Python Programming
Learn python
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
Python Programming Language
Ad

More from ZENUS INFOTECH INDIA PVT. LTD. (14)

PDF
100+ Tally shortcut key
PDF
Introduction to AutoCAD Commands
PPTX
Introduction of Industrial Designing Software by ZENUS INFOTECH
PDF
ZENUS is best for CAD Training
PDF
BEST IT & CAD Training Compnay
PPTX
Project report on AutoCAD | ZENUS INFOTECH INDIA PVT. LTD.
PDF
PHP | ZENUS INFOTECH INDIA PVT. LTD.
PDF
JAVA Training | ZENUS INFOTECH INDIA PVT. LTD.
PDF
Ansys Training | ZENUS INFOTECH INDIA PVT. LTD.
PDF
MCA ( Govt. of India) approved Training company in Roorkee
PDF
ZENUS INFOTECH INDIA PVT. LTD. is also engage with skill India mission
PDF
IIT DEHLI students training latter
PDF
ZENUS INFOTECH INDIA PVT. LTD. is also Training Partner of RCE ENGG. COLLEGE
PDF
100+ Tally shortcut key
Introduction to AutoCAD Commands
Introduction of Industrial Designing Software by ZENUS INFOTECH
ZENUS is best for CAD Training
BEST IT & CAD Training Compnay
Project report on AutoCAD | ZENUS INFOTECH INDIA PVT. LTD.
PHP | ZENUS INFOTECH INDIA PVT. LTD.
JAVA Training | ZENUS INFOTECH INDIA PVT. LTD.
Ansys Training | ZENUS INFOTECH INDIA PVT. LTD.
MCA ( Govt. of India) approved Training company in Roorkee
ZENUS INFOTECH INDIA PVT. LTD. is also engage with skill India mission
IIT DEHLI students training latter
ZENUS INFOTECH INDIA PVT. LTD. is also Training Partner of RCE ENGG. COLLEGE

Recently uploaded (20)

PDF
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
PPTX
Presentation on Janskhiya sthirata kosh.
PPTX
An introduction to Prepositions for beginners.pptx
PDF
What Is Coercive Control? Understanding and Recognizing Hidden Abuse
PPTX
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
PPTX
An introduction to Dialogue writing.pptx
PPTX
vedic maths in python:unleasing ancient wisdom with modern code
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
PPTX
Strengthening open access through collaboration: building connections with OP...
PPTX
Software Engineering BSC DS UNIT 1 .pptx
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PDF
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
PPTX
Congenital Hypothyroidism pptx
PDF
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PDF
5.Universal-Franchise-and-Indias-Electoral-System.pdfppt/pdf/8th class social...
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PPTX
IMMUNIZATION PROGRAMME pptx
PPTX
ACUTE NASOPHARYNGITIS. pptx
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
Presentation on Janskhiya sthirata kosh.
An introduction to Prepositions for beginners.pptx
What Is Coercive Control? Understanding and Recognizing Hidden Abuse
PPTs-The Rise of Empiresghhhhhhhh (1).pptx
An introduction to Dialogue writing.pptx
vedic maths in python:unleasing ancient wisdom with modern code
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Strengthening open access through collaboration: building connections with OP...
Software Engineering BSC DS UNIT 1 .pptx
UPPER GASTRO INTESTINAL DISORDER.docx
Cell Biology Basics: Cell Theory, Structure, Types, and Organelles | BS Level...
Congenital Hypothyroidism pptx
3.The-Rise-of-the-Marathas.pdfppt/pdf/8th class social science Exploring Soci...
NOI Hackathon - Summer Edition - GreenThumber.pptx
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
5.Universal-Franchise-and-Indias-Electoral-System.pdfppt/pdf/8th class social...
Cardiovascular Pharmacology for pharmacy students.pptx
IMMUNIZATION PROGRAMME pptx
ACUTE NASOPHARYNGITIS. pptx

Introduction of Python

  • 2. Python3 1. Python laid its foundation in the late 1980s. 2. The implementation of Python was started in the December 1989 by Guido Van Rossum at CWI in Netherland. 3. In February 1991, van Rossum published the code. 4. In 1994, Python 1.0 was released with new features like: lambda, map, filter, and reduce. 5. Python 2.0 added new features like: list comprehensions, garbage collection system was introduced in 2000. 6. On December 3, 2008, Python 3.0 (also called "Py3K") was released. It was designed to rectify fundamental flaw of the language. 7. Python is influenced by the programming languages like ABC language and Modula-3.
  • 3. Why we need Python? Python has top the charts in the recent years over other programming languages like C, C++ and Java and is widely used by the programmers. The software development companies prefer Python language because of its versatile features and fewer programming codes. The language has extensive support libraries and clean object-oriented designs that increase two to tenfold of programmer’s productivity while using the languages like Java, VB, Perl, C, C++ and C#. The Python language has diversified application in the software development companies such as in gaming, web frameworks and applications, language development, prototyping, graphic design applications, etc. It provides large standard libraries that include the areas like string operations, Internet, web service tools, operating system interfaces and protocols.
  • 4. Interactive Shell The interactive shell is also interactive in the way that it stands between the commands or actions and their execution. This means the Shell waits for commands from the user, which it executes and returns the result of the execution. After this the shell waits for the next input. Applications of Python GUI-Based Desktop Applications Image Processing and Graphic Design Applications Scientific and Computational Applications Games Web Frameworks and Web Applications Enterprise and Business Applications Operating Systems Language Development Prototyping
  • 5. Advantages of Python Programming Language Extensive Libraries Python libraries contain code for various purposes like regular expressions, documentation-generation, unit-testing, web browsers, threading, databases, CGI, email, image manipulation, and more. Extensible Python can be extended to other languages. You can write some of your code in languages like C++ or C. This comes in handy, especially in projects. Improved Productivity The language’s simplicity and extensive libraries render programmers more productive than languages like Java and C++ do. Also, the fact that you need to write less lets more get done.
  • 6. IOT Opportunities Since Python forms the basis of new platforms like Raspberry Pi, it finds the future bright for Internet Of Things. This is a way to connect the language with the real world. Simple and Easy When working with Java, you may have to create a class to print ‘Hello World’. But in Python, just a print statement will do. It is also quite easy to learn, understand, and code. This is why when people pick up Python, they have a hard time adjusting to other more verbose languages like Java. Readable Because it is not such a verbose language, reading Python is much like reading English. This is also why it is so easy to learn, understand, and code. It also does not need curly braces to define blocks, and indentation is mandatory. This further aids the readability of the code. Object-Oriented This language supports both the procedural and object-oriented programming paradigms. While functions help us with code reusability, classes and objects let us model the real world. A class allows the encapsulation of data and functions into one.
  • 7. Free and Open-Source Python is freely available. But not only can you download python for free, but you can also download its source code, make changes to it, and even distribute it. It downloads with an extensive collection of libraries to help you with your tasks. Portable When you code your project in a language like C++, you may need to make some changes to it if you want to run it on another platform. But it isn’t the same with Python. Here, you need to code only once, and you can run it anywhere. This is called Write Once Run Anywhere (WORA). However, you need to be careful enough not to include any system-dependent features. Interpreted Python is an interpreted language. Since statements are executed one by one, debugging is easier than in compiled languages.
  • 8. Disadvantages of Python Programming Language Speed Limitations We have seen that Python code is executed line by line. But since Python is interpreted, it often results in slow execution. This, however, isn’t a problem unless speed is a focal point for the project. In other words, unless high speed is a requirement, the benefits offered by Python are enough to distract us from its speed limitations. Weak in Mobile Computing and Browsers While it serves as an excellent server-side language, Python is much rarely seen on the client-side. Besides that, it is rarely ever used to implement smartphone-based applications. Design Restrictions As you know, Python is dynamically-typed. This means that you don’t need to declare the type of variable while writing the code.
  • 9. Underdeveloped Database Access Layers Compared to more widely used technologies like JDBC (Java DataBase Connectivity) and ODBC (Open DataBase Connectivity), Python’s database access layers are a bit underdeveloped. Consequently, it is less often applied in huge enterprises. Interactive vs Normal Mode Python has two basic modes normal and interactive mode. The normal mode is the mode where the scripted and finished .py files are run in the Python interpreter. Interactive mode is a command line shell which gives immediate feedback for each statement, while running previously fed statements in active memory. As new lines are fed into the interpreter, the fed program is evaluated both in part and in whole.
  • 10. Python Character Set A…….Z ASCII value 65 to 90 a……….z ASCII value 97 to 122 0……..9 ASCII value 48 to 57 Special Characters Python Tokens Each single unit which together combine to a statement is known as tokens. Keywords Python has a set of keywords that are reserved words that cannot be used as variable names, function names, or any other identifiers. E.g. and, as, in etc. Python Identifiers An identifier is a name given to entities like class, functions, variables, etc. It helps to differentiate one entity from another.
  • 11. Rules for writing identifiers Identifiers can be a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore _. Names like myClass, var_1 and print_this_to_screen, all are valid example. An identifier cannot start with a digit. 1variable is invalid, but variable1 is perfectly fine. Keywords cannot be used as identifiers. We cannot use special symbols like !, @, #, $, % etc. in our identifier. Identifier can be of any length. Python is case sensitive Python is a case-sensitive language. This means, sum and Sum are not the same. Always name identifiers that make sense. Python Literals Literals can be defined as a data that is given in a variable or constant.
  • 12. String literals "Arjun" , '12345' Numeric literals 100, -26.2 Boolean literals True or False Special literals None is used to specify to that field that is not created. Literal Collections Collections such as tuples, lists and Dictionary are used in Python Python support the following literals Python Operators Python language supports the following types of operators. Arithmetic Operators Comparison (Relational) Operators Assignment Operators Logical Operators Bitwise Operators Membership Operators Identity Operators
  • 13. Python Arithmetic Operators Operator Example + Addition 10 + 20 = 30 - Subtraction 10 – 20 = -10 * Multiplication 10 * 20 = 200 / Division 5/ 2 = 2.5 % Modulus 10 % 2 = 0 ** Exponent 2**3 =8 // Integer Division 5//2 = 2 Python Comparison Operators Operator Example == (2== 3) is not true. != (2!= 3) is true. <> (2<> 3) is true. This is similar to != operator. > (2 > 3) is not true. < (2 < 3) is true. >= (2 >= 3) is not true. <= (2 <= 3) is true.
  • 14. Python Assignment Operators Operator Example = c = a + b assigns value of a + b into c += Add AND c += a is equivalent to c = c + a -= Subtract AND c -= a is equivalent to c = c - a *= Multiply AND c *= a is equivalent to c = c * a /= Divide AND c /= a is equivalent to c = c / ac /= a is equivalent to c = c / a %= Modulus AND c %= a is equivalent to c = c % a **= Exponent AND c **= a is equivalent to c = c ** a //= Floor Division c //= a is equivalent to c = c // a Python Bitwise Operators Python Bitwise Operators Operator Example & Binary AND (a & b) (means 0000 1100) | Binary OR (a | b) = 61 (means 0011 1101) ^ Binary XOR (a ^ b) = 49 (means 0011 0001) ~ Binary Ones Complement (~a ) = -61 (means 1100 0011 in 2's complement form due to a signed binary number. << Binary Left Shift a << 2 = 240 (means 1111 0000) >> Binary Right Shift a >> 2 = 15 (means 0000 1111)
  • 15. Python Logical Operators Python Logical Operators Operator Example and Logical AND (a and b) is true. or Logical OR (a or b) is true. not Logical NOT Not(a and b) is false. Python Membership Operators Operato r Example in x in y, here in results in a 1 if x is a member of sequence y. not in x not in y, here not in results in a 1 if x is not a member of sequence y. Python Identity Operators Operator Example is x is y, here is results in 1 if id(x) equals id(y). is not x is not y, here is not results in 1 if id(x) is not equal to id(y).
  • 16. Python Operators Precedence The following table lists all operators from highest precedence to lowest. Precedence Operator 1 ** Exponent 2 ~ + - Complement, unary plus and minus 3 * / % // Multiply, divide, modulo and floor division 4 + - Addition and subtraction 5 >> << Right and left bitwise shift 6 & Bitwise 'AND' 7 ^ | Bitwise exclusive `OR' and regular `OR' 8 <= < > >= Comparison operators 9 <> == != Equality operators 10 = %= /= //= -= += *= **= Assignment operators 11 is is not Identity operators 12 in not in Membership operators 13 not or and Logical operators
  • 17. Python Data Types Python provides various standard data types that define the storage method on each of them. The data types defined in Python are given below. Numbers String List Tuple Dictionary Numbers Number stores numeric values. Python creates Number objects when a number is assigned to a variable. For example a = 3 , b = 5 a and b are number objects Python supports 4 types of numeric data int (signed integers like 10, 2, 29, etc.) long (long integers used for a higher range of values like 908090800L, - 0x1929292L, etc.) float (float is used to store floating point numbers like 1.9, 9.902, 15.2, etc.) complex (complex numbers like 2.14j, 2.0 + 2.3j, etc.)
  • 18. Strings The string can be defined as the sequence of characters represented in the quotation marks. In python, we can use single, double, or triple quotes to define a string. String handling in python is a straightforward task since there are various inbuilt functions and operators provided. List Lists are similar to arrays in C. However the list can contain data of different types. The items stored in the list are separated with a comma (,) and enclosed within square brackets []. Tuple A tuple is similar to the list in many ways. Like lists, tuples also contain the collection of the items of different data types. The items of the tuple are separated with a comma (,) and enclosed in parentheses (). A tuple is a read-only data structure as we can't modify the size and value of the items of a tuple.
  • 19. Dictionary Dictionary is an ordered set of a key-value pair of items. It is like an associative array or a hash table where each key stores a specific value. Key can hold any primitive data type whereas value is an arbitrary Python object. The items in the dictionary are separated with the comma and enclosed in the curly braces {}. Mutable and Immutable Data Types in Python Since everything in Python is an Object, every variable holds an object instance. When an object is initiated, it is assigned a unique object id. Its type is defined at runtime and once set can never change, however its state can be changed if it is mutable. A mutable object can be changed after it is created, and an immutable object can’t. Mutable Data Types: int, float, bool, str, tuple Immutable Data Types: list, set, dict
  • 20. Thanks you Contact Info ZENUS INFOTECH INDIA PVT. LTD Near Hotel Deep Residency, Ram Nagar Chowk Roorkee - 247667(Uttrakhand) Phone:01332-261250 Mobile:+91-8218088730 E-Mail:[email protected]