0% found this document useful (0 votes)
3 views15 pages

Python Programming Overview by Gagan Puri

The document provides an overview of Python, a high-level programming language created by Guido van Rossum in 1991, covering its features, IDEs, package management with pip, and environment management. It details fundamental concepts such as tokens, identifiers, data types, type casting, and operators. Additionally, it discusses tools for managing Python environments and the importance of creating isolated environments for different projects.

Uploaded by

hellfire83675
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)
3 views15 pages

Python Programming Overview by Gagan Puri

The document provides an overview of Python, a high-level programming language created by Guido van Rossum in 1991, covering its features, IDEs, package management with pip, and environment management. It details fundamental concepts such as tokens, identifiers, data types, type casting, and operators. Additionally, it discusses tools for managing Python environments and the importance of creating isolated environments for different projects.

Uploaded by

hellfire83675
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

Python

Gagan Puri
[Link]/in/puri-gagan
higaganpuri@[Link]
Contents

Introduction

IDE

pip

Environment Management

Tokens

Identifiers

Data Types

Type Cast

Operators

Next Class
Python


High-level, interpreted, general-purpose programming language

Created by Guido van Rossum and released in 1991

3.13

Python uses indentation (whitespace) to define blocks of code, rather than braces {}
IDE


Pycharm

VS Code

Jupyter Notebook
pip

package installer for Python

Install, update, and manage Python libraries (also called packages or modules)

From the Python Package Index (PyPI) and other repositories
Environments

Practice of creating isolated environments for Python projects

Used to ensure that the libraries and dependencies used for one project don't conflict with those in
another project

Useful when working on multiple projects that require different versions of libraries or Python

Easier Deployment
Tools to manage python environments

venv (Built-in Tool)

python3 -m venv myenv

source myenv/bin/activate

myenv\Scripts\activate

Virtualenv

pip install virtualenv

virtualenv myenv

Conda
Anaconda / Mini Conda Environments
Managing Environments
Managing Environments
Tokens

Tokens are the smallest units in a Python program. They are the building blocks of any program

Keywords: Reserved words that have a special meaning in Python. Examples: if, for, while, class, def,
try, etc

print([Link])

Identifiers: Names given to variables, functions, classes, etc

Literals: Fixed values that appear directly in code. Example: 5, "Hello"

Operators: Symbols used to perform operations on variables and values. Example: +, -, *, ==

Separators: Symbols used to separate statements or blocks of code. Example: :, ,, ;, (), {}, []

Comments: Non-executing text used to explain the code. Single-line comments begin with #, while
multi-line comments are written between “” “” or '''
Indentifiers

Identifier is a name used to identify a variable, function, class, module, or other object

It must begin with a letter (A-Z or a-z) or an underscore (_).

It can contain digits (0-9) after the first letter

Python identifiers are case-sensitive (e.g., var, Var, VAR are different)

Keywords cannot be used as identifiers

Identifiers can’t contain only digits

No limit on the length of the identifier name in python
Data Types

Numbers:

int: Integer (e.g., 5, -3).

float: Floating-point numbers (e.g., 3.14, -0.001).

complex: Complex numbers (e.g., 3+5j).

Strings: A sequence of characters (e.g., "Hello World", 'Python').

Strings can be enclosed in single quotes (') or double quotes (").

Lists: Ordered, mutable collection of elements (e.g., [1, 2, 3, 'a', 4.5]).

Tuples: Ordered, immutable collection (e.g., (1, 2, 3)).

Dictionaries: Unordered collection of key-value pairs (e.g., {'name': 'Alice', 'age': 25}).

Sets: Unordered collection of unique elements (e.g., {1, 2, 3, 4}).

Booleans: Represents True or False
Type Casting

Conversion between different data types using built-in functions

int(): Converts to an integer.

float(): Converts to a floating-point number.

str(): Converts to a string.

list(), tuple(), set(), dict(): Convert between different collection types
Operators

Operators are symbols used to perform operations on variables or values

Arithmetic Operators: +, -, *, /, // (floor division), % (modulus), ** (exponentiation).

Comparison Operators: ==, !=, >, <, >=, <=.

Logical Operators: and, or, not.

Assignment Operators: =, +=, -=, *=, /=, //=, %=, **=.

Bitwise Operators: &, |, ^, ~, <<, >>.

Membership Operators: in, not in.

Identity Operators: is, is not

You might also like