0% found this document useful (0 votes)
2 views8 pages

Module - 1 Introduction To Python

Python is a high-level, open-source, object-oriented, and procedural programming language created by Guido van Rossum, with its first version released in 1991. It features dynamic programming, a rich library collection, and is OS independent, making it versatile for various applications. The document also covers Python tokens, identifiers, literals, punctuators, keywords, operators, and data types, providing a comprehensive overview of its structure and functionality.

Uploaded by

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

Module - 1 Introduction To Python

Python is a high-level, open-source, object-oriented, and procedural programming language created by Guido van Rossum, with its first version released in 1991. It features dynamic programming, a rich library collection, and is OS independent, making it versatile for various applications. The document also covers Python tokens, identifiers, literals, punctuators, keywords, operators, and data types, providing a comprehensive overview of its structure and functionality.

Uploaded by

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

Introduction to Python

Definition:
“Python is a H O O P progamming language”
H (High Level) -> Easily Understandable (i.e English Languague)
O (Open Source) -> Everyone can acess, free for all
O (Object Oriented) -> Modeling the Real World using Classes and Objects.
P (Procedural) -> Step by Step Execution

History:
 Guido Vann Russon invented Python
 Foundations were lead in 1980
 First program in 1991
 There are 3 versions of python till date:
o 1993 Jan
o 2000 Oct
o 2008 Dec
 Currently we are using Version-3 of Python

Features of Python: (D R S O P H I E)
1. Dynamic Programming (Variable types are checked during execution)
2. Rich in Libraries (It has a vast collection of pre-written modules)
3. Systematic or Object Oriented (Code is organized around real-world objects)
4. O.S Independent (Python code can run on any major operating system)
5. Procedural (It supports writing code as a sequence of statements)
6. High Level (Code is written closer to human language )
7. Interpreted (Code is executed line-by-line by an interpreter)
8. Easy to Understand
Tokens:
 Smallest individual units of a program that are meaningful to the Python
interpreter
 There are diff types of Tokens they are:
 Identifiers
 Literals
 Punctuators
 Keywords
 Operators
Identifiers:
 Names used to identify variables, functions, classes, modules, or other
objects.
 There are certain rules for writing an identifier:
o They can start with letter or _
o Can have numbers but cannot strt with it
o No Spaces in between
o No special characters other than “_”
 Ex: count, _myclass
Literals:
 Raw data values given in a variable or constant. They are the fixed values.
 These can be int, float , str, bool and null
 Ex: 10(integer), 12.3(float), “abc”(string)
Punctuators:
 Symbols used to organize and structure the code .
 There are different types:
o ( ) Function calls, grouping expressions, defining tuples.
o { } Defining sets or dictionaries.
o [ ] Defining lists, or accessing elements via indexing (e.g., list[0]).
o : Indicates the start of an indented block
o , Separates items in a list, tuple, set, dictionary …..
o . Used to access attributes or methods of an object
o “ “ Delimits a string literal (a sequence of characters).
o # Designates the rest of the line as a comment.
Keywords:
 Reserved words that have a fixed meaning and cannot be used as
identifiers.
 These cannot be used as a variable name
 Ex: for, if, else ……
Operators:
 Symbols that help to perform various operations.
 Allows data manipulation
 There are diff types:

o Arithmetic Operators
o Comparison (Relational) Operators
o Logical Operators
o Assignment Operators
o Bitwise Operators
o Identity Operators
o Membership Operators

Arithmetic:

 These are used to perform basic mathematical operations.


Comparision:

 These compare two values and return a Boolean result .

Logical Operators:

 These combine Boolean values ( or ) to return a single Boolean result.


Assignment Operators

 These are used to assign a value to a variable. The combined operators are
shorthand for performing an operation and assignment simultaneously.

Bitwise Operators

 These operate on the individual bits (0s and 1s) of integers.


Identity Operators

 These compare the memory locations of two objects, checking if they are the
exact same object.

Membership Operators

 These test whether a sequence (like a list, tuple, or string) contains a specific
value.
Data Types:

 It says a variable can store which type of variable in it.


 There are different data types:

1. Numeric:
 These types hold number values.
 They are divided into diff parts:

1. Integer – Whole numbers


Example: 10, -5
2. Float – Decimal numbers
Example: 3.14, -0.5
3. Complex Number – Numbers with real and imaginary parts
Example: 3+5j

2. Dictionary:

You might also like