Python-Basic to Advanced
What is Python?
Python is high-level programming language. Python language Created by Guido van Rossum. Python First Released in 1991.
Why is Python So Popular Language?
- Simple Syntax
- Totally Free & Open Source
- Support For Beginners & Experts
- Used By Popular Organiza on
What is Python Used For?
- Machine Learning & Artificial Intelligence
- Data Analysis
- Web Development
- Automa on
- Game Development
Python Required Software
- Python
- PyCharm ( Ofline Code IDE)
- Google Colab( Online Code IDE)
Python Version History
- Python 1.X & 2.X
- Python 3.X
Python-Basic to Advanced
Basic Of Python
Python Print(“ “)
String in Python Use (” ”)
Example

Print(1+4)
Example

Python Comment
Comments are used for code explanation
- Single-Line Comment
- Multi-Line Comment
Example

Multi-Line Comment Use “”” “”” Symbol
Example

Python Escape Sequences
Python Escape Sequences Is a combina on characters that represent a special characters when used inside a string .
Common Python Escape Sequences:
Newline ( line break) = \n


Singel Quote = \’
Example

Example

Python Variables
Python Variables Used to Store Data Values. Python variables are initialized with strings.
Example








Python Data Types
Python data type specifies the type of data a variable can hold.
Common Python Data Types: String Data ‘str’
Example
Numeric Data Types ( int , float, complex)
Example ( int data type)
Example ( float data type)
Example ( complex data type)

Boolean Data Type ( True, False)
Example (True)

Example (False)


Example ( int data type)



Boolean Data Type ( True, False)
Example (True)

Example (False)

Python Memory Management
Memory management in Python refers to how the language handles the allocation memory during the execution of programs.
Example (id())


Python User Input Python User Input the input() func on is used to capture user input.
Example


Python Type Casting
Python always accepts everything as string data when taking user input.
Many times when user input is required to take other data, then Python
type casting is required.
Example (Before Type Casting)

Example (After Type Casting)

Operators in Python
Python Operators Operators in Python are special symbols that operate on variables and values.
Types of Operators in Python:
Arithmetic Operators
Example (Additional Operator)
Example (Subtraction Operator)
Example (Multiplication Operator)
Example (Division Operator)

Comparison Operators

Logical Operators

Python Math Library Function

if-else in Python


Python User Input the input() func on is used to capture user input.
Example

Python Type Casting
Python always accepts everything as string data when taking user input.
Many times when user input is required to take other data, then Python
type casting is required.
Example (Before Type Casting)


Operators in Python
Python Operators Operators in Python are special symbols that operate on variables and values.
Types of Operators in Python:
Arithmetic Operators
Example (Additional Operator)
Example (Subtraction Operator)
Example (Multiplication Operator)
Example (Division Operator)

Comparison Operators

Logical Operators

Python Math Library Function

if-else in Python
Types of Operators in Python:





Comparison Operators

Logical Operators

Python Math Library Function

if-else in Python
if_else Python
if-else statement in Python is used for decision-making.
if expression:
statement ()
else:
statement ()
Example 1

if-else statement in Python is used for decision-making.
if expression:
statement ()
else:
statement ()
Example 2 (Calculate EvenOdd Number)

elif Python
elif statement in Python is short for "else if" and is used in decision-making to test multiple conditions.
Example

Nested if in Python
Nested if statement in Python is when you place one if statement inside
another if (elif or else) statement.
Example

Loop in Python
While Loop in PythonPython while loop is a control flow statement that repeatedly executes a
block of code as long as a given condition is true.
Example
for loop in Python
Python for loop is another control flow statement that iterates over a
sequence and executes a block of code for each element in the
sequence.
Example

Range in Python
The range () function in Python generates a sequence of numbers.
Example

elif statement in Python is short for "else if" and is used in decision-making to test multiple conditions.
Example
Nested if statement in Python is when you place one if statement inside another if (elif or else) statement.
Example
Loop in Python
Python while loop is a control flow statement that repeatedly executes a
block of code as long as a given condition is true.
Example
Python for loop is another control flow statement that iterates over a
sequence and executes a block of code for each element in the
sequence.
Example
Range in Python
The range () function in Python generates a sequence of numbers.
Example
More Basic of Python
Python Break and Continue
Python break and continue control flow statements that alter
the execution of loops.
String in Python
Python String is a sequence of characters.
Example

List in PythonPython String is a sequence of characters.
Example
Array in Python
Python array is similar to a list, but typically used with more specific
numeric types.
Example
Dictionary in PythonPython dictionary is an unordered collection of key-value pairs.
Example

Tuple in Python
Python tuple is an immutable, ordered collection of items.
Example

Set in Python
Python set is an unordered collection of unique items.
Example

Def Function in Python
In Python def is used to define a function. Def Functions help modularize
code, improving readability and reusability.
Example

Lambda Function in Python
Lambda function to define the anonymous function.
Example

Map Function in Python
Map function is used to apply a given function to every item in an
Repeatable and return a map object.
Example

Zip Function in Python
zip function in Python takes multiple Repeatables and aggregates them
into tuples, pairing elements from each Repeatable at the same index.
Example

Advanced Topic in Python
Exception Handling in Python
Exception handling in Python allows you to handle errors gracefully and
avoid program crashes.
Example

Class and Object in Python
Python classes are blueprints for creating objects (instances), which
encapsulate both data (properties) and behavior (methods).
Example

File in Python
Python file handling allows you to read from and write to files on your
filesystem.
Python has some advanced libraries. For example:
- Pandas Library
- Numpy Library
- Matplotlib Library
- Seaborn Library ,etc
These libraries are especially used in data science, data analysis, machine learning.
Random Password Generate
import random
chars='abcdefghijklmnopqurstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789!
@#$%^&*()[]{}'
Length=int(input('Enter The Length Password: '))
Password=''
for i in range(Length):
Password+=random.choice(chars)
print( 'Your Password:',Password)
Example

Python Break and Continue
Python break and continue control flow statements that alter
the execution of loops.
String in Python
Python String is a sequence of characters.
Example
Python String is a sequence of characters.
Example
Python array is similar to a list, but typically used with more specific numeric types.
Example
Python dictionary is an unordered collection of key-value pairs.
Example
Tuple in Python
Python tuple is an immutable, ordered collection of items.
Example
Set in Python
Python set is an unordered collection of unique items.
Example
Def Function in Python
In Python def is used to define a function. Def Functions help modularize
code, improving readability and reusability.
Example
Lambda Function in Python
Lambda function to define the anonymous function.
Example
Map Function in Python
Map function is used to apply a given function to every item in an
Repeatable and return a map object.
Example
Zip Function in Python
zip function in Python takes multiple Repeatables and aggregates them
into tuples, pairing elements from each Repeatable at the same index.
Example
Exception Handling in Python
Exception handling in Python allows you to handle errors gracefully and
avoid program crashes.
Example
Class and Object in Python
Python classes are blueprints for creating objects (instances), which
encapsulate both data (properties) and behavior (methods).
Example
File in Python
Python file handling allows you to read from and write to files on your
filesystem.
Python has some advanced libraries. For example:
- Pandas Library
- Numpy Library
- Matplotlib Library
- Seaborn Library ,etc
Random Password Generate
import random
chars='abcdefghijklmnopqurstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789!
@#$%^&*()[]{}'
Length=int(input('Enter The Length Password: '))
Password=''
for i in range(Length):
Password+=random.choice(chars)
print( 'Your Password:',Password)
Example
Download the Python Basic to Advanced file PDF: Python Basic to Advanced
Author Identify
Name: Meharin Hasna Puspo
Studying Diploma in Computer Science Engineering,
Python |Data Analysis |Data Science | Machine learning
Studying Diploma in Computer Science Engineering,
Python |Data Analysis |Data Science | Machine learning