VEERANAN VEERANAN
Assistant Professor in Information Technology
Department of Information Technology
P.K.N. Arts and Science College
Tirumangalam
Madurai
 Python is a high-level, interpreted, and object-oriented
language created by Guido van Rossum (1991). It is simple,
readable, and versatile, supporting OOP and procedural
programming.
 Widely used in web development, AI/ML, data science,
automation, and more, it offers extensive libraries, automatic
memory management, and portability.
 Major users include Google, YouTube, Netflix, Instagram, and
NASA.
Mr. VV, ASP IT, PKN
 Creator: Guido van Rossum (1980s–1990s)
 Influenced by ABC, C, Unix Shell
 Versions: 1991 → Python 1.0, 2000 →
Python 2.0, 2010+ → Python 3.x
Mr. VV, ASP IT, PKN
 1. Simple & Readable (NASA scripts)
 2. Free & Open Source (Google projects)
 3. Portable & Interpreted (Dropbox client)
 4. OOP + Procedural (Instagram backend)
 5. Extensive Libraries (Netflix engine)
 6. Memory Management (Spotify pipelines)
 7. Robust & Multi-threaded (YouTube uploads)
Mr. VV, ASP IT, PKN
 Web Dev: Django, Flask (Instagram)
 AI/ML: TensorFlow, PyTorch (Tesla)
 Scientific: NumPy, SciPy (NASA)
 Automation: Selenium, os (Google IT)
 Data Analytics: Pandas, Matplotlib (YouTube)
 Games: PyGame (Civilization-IV)
 GUI: Tkinter, PyQt (Dropbox client)
Mr. VV, ASP IT, PKN
 Keywords: if, while, def, class,True, None
 Identifiers: start with letter/_ case-sensitive, no special
symbols
 Variables: No type declaration x=10
→
 Data Types: Immutable int, float, str, tuple;
→
Mutable list, dict, set
→
 I/O: input(), print()
 Comments: # or ''' '''
 Indentation: Defines blocks (no {})
Mr. VV, ASP IT, PKN
Aspect Operators Expressions
Definition Symbols that perform operations on values. Code that evaluates to a single value.
Purpose
Perform arithmetic, logical, relational, or
assignment operations.
Compute or return a value.
Examples +, -, *, /, ==, and, or
2 + 3 * 4, x > 10 and y < 5, len("Hi") +
1
Returns Usually primitive values (int, float, bool). Always results in a single value.
Usage in
Python
a + b, x == y, not flag sum([1,2,3]) / len([1,2,3])
Mr. VV, ASP IT, PKN
Topic Operators Use Case Example
Arithmetic + - * / % // ** Price, discount, tax 10 ** 3 1000
→
Relational == != > < >= <= Login, validation 5 >= 3 True
→
Logical and or not Account checks x>0 and y>0
Bitwise `& ^ ~ << >>` IoT, image processing
Assignment
= += -= *= /= //= %=
**=
Update scores x+=5
Membership in, not in Stock check "apple" in fruits
Identity is, is not Cache, memory check a is b
Precedence
`() > ** > +x/-x/~x >
* / // % > + - > << >> >
& > ^ >
> comparisons > not >
and > or`
Expression solving
Mr. VV, ASP IT, PKN
Expression Type Operators / Usage Real-Life Use
Constant Expressions
Only constants (10 + 5, 3.14
* 2)
Fixed calculations like tax =
100 * 5%
Arithmetic Expressions + - * / % // **
Calculating area, total price
in e-commerce
Relational Expressions == != > < >= <=
Checking user age ≥ 18 for
eligibility
Logical Expressions and or not
Login condition: user exists
and password correct
Bitwise Expressions `& ^ ~ << >>`
Assignment Expressions = with values (x = 5 + 3)
Storing score, updating
bank balance
String Expressions
+ (concatenation), *
(repetition)
Generating messages like
"Hello" + name
Expressions
Mr. VV, ASP IT, PKN
Type Conversion Functions Example Use Case
Explicit int(), float(), str(), list(), tuple() int("10") 10
→ User input price calculation
Implicit Auto handled by Python 2 + 2.5 4.5
→ Stock trading app
Type Conversion is the process of changing the data type of a value or variable into another data
type.
In Python, this can happen automatically (implicit) or manually (explicit).
It is often used to make data compatible for operations or functions.
Implicit Type Conversion (Type Casting / Type Promotion)
1.Done automatically by Python.
2.Example: int + float → float
Explicit Type Conversion (Type Casting)
1.Done manually using functions like int(), float(), str(), etc.
Mr. VV, ASP IT, PKN
Strings Methods Example
Concatenate + "Hello"+"World"
Repeat * "Hi!"*3 Hi!Hi!Hi!
→
Slice [start:end] "Python"[:3] Pyt
→
Case Conversion upper(), lower(), title(), capitalize() "hi".upper() HI
→
Strip & Replace strip(), replace() " hi ".strip() hi
→
Split & Join split(), join() "a,b".split(",") ['a','b']
→
Search find(), startswith(), endswith() "python".find("th") 2
→
f-String f"Name: {name}" Name: Alice
A string is a sequence of characters enclosed in single (' '), double (" "), or triple quotes (''' ''').
Immutable (cannot be changed after creation)
Indexed & Sliced (s[0], s[1:4])
Example:
s = "Python"
print(s.upper()) # 'PYTHON'
print(s[0:3]) # 'Pyt'
Mr. VV, ASP IT, PKN
Array (array module) Methods Example
Create array('i',[10,20,30]) Integers only
Append & Insert append(), insert() [10,15,20,30]
Remove & Pop remove(), pop() [10,15,30,40]
Index & Slice index(), [1:3] index(30) 2
→
Reverse & Sort reverse(), sort() [40,30,15,10]
 An array is a collection of items stored at contiguous memory locations.
 In Python, we mostly use lists as arrays, but there is also a special array module for numeric
arrays.
Mr. VV, ASP IT, PKN

Python Programming Essentials – A Student-Friendly Approach.ppt

  • 1.
    VEERANAN VEERANAN Assistant Professorin Information Technology Department of Information Technology P.K.N. Arts and Science College Tirumangalam Madurai
  • 2.
     Python isa high-level, interpreted, and object-oriented language created by Guido van Rossum (1991). It is simple, readable, and versatile, supporting OOP and procedural programming.  Widely used in web development, AI/ML, data science, automation, and more, it offers extensive libraries, automatic memory management, and portability.  Major users include Google, YouTube, Netflix, Instagram, and NASA. Mr. VV, ASP IT, PKN
  • 3.
     Creator: Guidovan Rossum (1980s–1990s)  Influenced by ABC, C, Unix Shell  Versions: 1991 → Python 1.0, 2000 → Python 2.0, 2010+ → Python 3.x Mr. VV, ASP IT, PKN
  • 4.
     1. Simple& Readable (NASA scripts)  2. Free & Open Source (Google projects)  3. Portable & Interpreted (Dropbox client)  4. OOP + Procedural (Instagram backend)  5. Extensive Libraries (Netflix engine)  6. Memory Management (Spotify pipelines)  7. Robust & Multi-threaded (YouTube uploads) Mr. VV, ASP IT, PKN
  • 5.
     Web Dev:Django, Flask (Instagram)  AI/ML: TensorFlow, PyTorch (Tesla)  Scientific: NumPy, SciPy (NASA)  Automation: Selenium, os (Google IT)  Data Analytics: Pandas, Matplotlib (YouTube)  Games: PyGame (Civilization-IV)  GUI: Tkinter, PyQt (Dropbox client) Mr. VV, ASP IT, PKN
  • 6.
     Keywords: if,while, def, class,True, None  Identifiers: start with letter/_ case-sensitive, no special symbols  Variables: No type declaration x=10 →  Data Types: Immutable int, float, str, tuple; → Mutable list, dict, set →  I/O: input(), print()  Comments: # or ''' '''  Indentation: Defines blocks (no {}) Mr. VV, ASP IT, PKN
  • 7.
    Aspect Operators Expressions DefinitionSymbols that perform operations on values. Code that evaluates to a single value. Purpose Perform arithmetic, logical, relational, or assignment operations. Compute or return a value. Examples +, -, *, /, ==, and, or 2 + 3 * 4, x > 10 and y < 5, len("Hi") + 1 Returns Usually primitive values (int, float, bool). Always results in a single value. Usage in Python a + b, x == y, not flag sum([1,2,3]) / len([1,2,3]) Mr. VV, ASP IT, PKN
  • 8.
    Topic Operators UseCase Example Arithmetic + - * / % // ** Price, discount, tax 10 ** 3 1000 → Relational == != > < >= <= Login, validation 5 >= 3 True → Logical and or not Account checks x>0 and y>0 Bitwise `& ^ ~ << >>` IoT, image processing Assignment = += -= *= /= //= %= **= Update scores x+=5 Membership in, not in Stock check "apple" in fruits Identity is, is not Cache, memory check a is b Precedence `() > ** > +x/-x/~x > * / // % > + - > << >> > & > ^ > > comparisons > not > and > or` Expression solving Mr. VV, ASP IT, PKN
  • 9.
    Expression Type Operators/ Usage Real-Life Use Constant Expressions Only constants (10 + 5, 3.14 * 2) Fixed calculations like tax = 100 * 5% Arithmetic Expressions + - * / % // ** Calculating area, total price in e-commerce Relational Expressions == != > < >= <= Checking user age ≥ 18 for eligibility Logical Expressions and or not Login condition: user exists and password correct Bitwise Expressions `& ^ ~ << >>` Assignment Expressions = with values (x = 5 + 3) Storing score, updating bank balance String Expressions + (concatenation), * (repetition) Generating messages like "Hello" + name Expressions Mr. VV, ASP IT, PKN
  • 10.
    Type Conversion FunctionsExample Use Case Explicit int(), float(), str(), list(), tuple() int("10") 10 → User input price calculation Implicit Auto handled by Python 2 + 2.5 4.5 → Stock trading app Type Conversion is the process of changing the data type of a value or variable into another data type. In Python, this can happen automatically (implicit) or manually (explicit). It is often used to make data compatible for operations or functions. Implicit Type Conversion (Type Casting / Type Promotion) 1.Done automatically by Python. 2.Example: int + float → float Explicit Type Conversion (Type Casting) 1.Done manually using functions like int(), float(), str(), etc. Mr. VV, ASP IT, PKN
  • 11.
    Strings Methods Example Concatenate+ "Hello"+"World" Repeat * "Hi!"*3 Hi!Hi!Hi! → Slice [start:end] "Python"[:3] Pyt → Case Conversion upper(), lower(), title(), capitalize() "hi".upper() HI → Strip & Replace strip(), replace() " hi ".strip() hi → Split & Join split(), join() "a,b".split(",") ['a','b'] → Search find(), startswith(), endswith() "python".find("th") 2 → f-String f"Name: {name}" Name: Alice A string is a sequence of characters enclosed in single (' '), double (" "), or triple quotes (''' '''). Immutable (cannot be changed after creation) Indexed & Sliced (s[0], s[1:4]) Example: s = "Python" print(s.upper()) # 'PYTHON' print(s[0:3]) # 'Pyt' Mr. VV, ASP IT, PKN
  • 12.
    Array (array module)Methods Example Create array('i',[10,20,30]) Integers only Append & Insert append(), insert() [10,15,20,30] Remove & Pop remove(), pop() [10,15,30,40] Index & Slice index(), [1:3] index(30) 2 → Reverse & Sort reverse(), sort() [40,30,15,10]  An array is a collection of items stored at contiguous memory locations.  In Python, we mostly use lists as arrays, but there is also a special array module for numeric arrays. Mr. VV, ASP IT, PKN