Python Programming
CT108-3-1
[Link] First Semester
Techspire College
New Baneshwor, Kathmandu
Course Content Outline and
Subtopics
• Introduction to programming
• Control Structure – Sequential, Selection and Iteration
• Data Collection
• String Interpolation
• Modular Programming
• File Handling
• Introduction to Problem Solving and Program Design
• Program Design Techniques – Pseudocode and Flowchart
• Outline the problem solving process
• Develop algorithm
• Apply problem solving technique using pseudocode and flowchart
• Practical Exercise and Lab Assignments
07/28/2025 Python Programming - KS 2
Introduction to Python Programming
Language
07/28/2025 Python Programming - KS 3
What is Python?
• It is a High Level Programming Language (eg: C, C++, Java, C#.......)
• It is a general purpose language
• Developed by Guido van Rossum
Created in 1989 and Released as open source in early 1991
07/28/2025 Python Programming - KS 4
Features of Python
• Easy and Simple to use
• Easy debugging and suitable for beginners
• Free and open source (You can make changes to it)
• Object-Oriented Programming (OOP)
• Large sets of library and packages
• Easy Syntax: Can complete coding in fewer lines as compared to other
languages (C++ or Java)
07/28/2025 Python Programming - KS 5
Easy and Simple to use
07/28/2025 Python Programming - KS 6
Python is Dynamically Typed
Language
• Whenever we are assigning some value to a variable, based on the
value, type will be considered automatically.
07/28/2025 Python Programming - KS 7
Application Areas of Python
• Web Applications
• Network Applications
• Games Development
• Data Analysis Applications
• Machine Learning Applications
• Artificial Intelligence, Deep Learning, Neural Network Applications
• IOT
• Data Science
Hence it is called General Purpose Programming Language
07/28/2025 Python Programming - KS 9
In the context of Nepal…
• Companies like Fusemachines, Leapfrog technology, Rosebay
Consulting are using python to perform AI and ML tasks.
• Companies like MPercept Technology, Treeleaf, Gritfeat perform
research on AI based on Python Programming Language.
• Different companies like Roosterlogic, Calcgen Solutions, Prixa Tech
seek for Python Developer, Django (Web framework of Python)
Developer, etc.
07/28/2025 Python Programming - KS 10
Most in-demand programming languages of
2023
07/28/2025 Python Programming - KS 11
A First Python Command
07/28/2025 Python Programming - KS 13
Python Command
07/28/2025 Python Programming - KS 14
Tokens
• A smallest individual unit in a program
07/28/2025 Python Programming - KS 15
Tokens
• A smallest individual unit in a program
identifier operator
Literal
keyword
punctuator
07/28/2025 Python Programming - KS 16
Tokens
• Identifier
⮚ the name given to identify a variable, function, class, module or other
object.
07/28/2025 Python Programming - KS 17
Tokens
• Identifier
Naming Conventions
07/28/2025 Python Programming - KS 18
Tokens
• Identifier
Naming Conventions
07/28/2025 Python Programming - KS 19
Tokens
• Operators
Symbols used for the logical, arithmetic and various other operations
07/28/2025 Python Programming - KS 20
Tokens
• Operators
✔ Arithmetic Operator: Used to perform mathematical operation on
numerical values
07/28/2025 Python Programming - KS 21
Tokens
• Operators
✔ Arithmetic Operator: Used to perform mathematical operation on
numerical values . Eg:
07/28/2025 Python Programming - KS 22
Tokens
• Operators
✔ Comparison (relational) Operator: Compare the values on either sides
of them and decide the relation among them.
07/28/2025 Python Programming - KS 23
Tokens
• Operators
✔ Comparison (relational) Operator: Compare the values on either sides
of them and decide the relation among them. Output is either True of False.
Eg:
07/28/2025 Python Programming - KS 24
Tokens
• Operators
✔ Assignment Operator: Used to assign values to variables.
07/28/2025 Python Programming - KS 25
Tokens
• Operators
✔ Logical Operator: Used to combine conditional statements.
07/28/2025 Python Programming - KS 26
Tokens
• Operators
✔ Logical Operator: Used to combine conditional statements.
Example:
07/28/2025 Python Programming - KS 27
Tokens
• Operators
✔ Bitwise Operator: Works on bits and performs bit by bit operation
07/28/2025 Python Programming - KS 28
Tokens
• Operators
✔ Bitwise Operator: Works on bits and performs bit by bit operation
Example:
07/28/2025 Python Programming - KS 29
Tokens
• Operators
✔ Bitwise Operator: Works on bits and performs bit by bit operation
Example:
07/28/2025 Python Programming - KS 30
Tokens
• Operators
✔ Membership Operator: Test for membership in a sequence such as
strings, lists or tuples.
07/28/2025 Python Programming - KS 31
Tokens
• Operators
✔ Membership Operator: Test for membership in a sequence such as
strings, lists or tuples. Example
07/28/2025 Python Programming - KS 32
Tokens
• Operators
✔ Identity Operator: Compare the memory locations of two objects.
07/28/2025 Python Programming - KS 33
Tokens
• Operators
✔ Identity Operator: Compare the memory locations of two objects.
Example
07/28/2025 Python Programming - KS 34
Operator Precedence
Describes the order in which
operations are performed
From highest precedence to lowest
07/28/2025 Python Programming - KS 35
Operator Precedence
Describes the order in which operations are performed
Example:
07/28/2025 Python Programming - KS 36
Reserved Words
✔Also called keywords
✔Defined with predefined meaning and syntax in the language
✔Can’t be used as identifiers like variable, function……
✔To check the keywords in your version
07/28/2025 Python Programming - KS 37
Reserved Words
List of keywords
07/28/2025 Python Programming - KS 38
Reserved Words
Count the number of reserved words
07/28/2025 Python Programming - KS 39