Python Programming
CT108-3-1
BSc.IT 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 Programming
• Programming is the process of creating a set of instructions that tells computer how to perform a
task.
• These instructions, often referred to as a code
• Basically, programming is the act of instructing a computer to perform a specific tasks or solve
problems
• It involves writing a sequence of instructions in a programming language
• Programming language is formal system used to communicate instructions to a computer
• Examples include: Python, C, C++, Java, JavaScript, C# etc
07/28/2025 Python Programming - KS 3
Introduction to Programming
• Problem Solving is a systematic approach to find and implement the solution of a problem
• Steps involved in Problem Solving Techniques
• Problem Definition
• Problem Analysis
• Designing a Program
• Algorithm
• Flowcharts
• Coding
• Program Testing
• Installation and Maintenance
07/28/2025 Python Programming - KS 4
Introduction to Programming
• Problem Definition – The first step is to identify and define the problem. The problem must be stated clearly, accurately
and precisely
• Problem Analysis – It helps in designing and coding for that particular problem. Provides input specifications (number of
inputs and what forms of input are available) and also output specification (number of outputs and what forms of output
should be displayed)
• Designing a program – Formulate an algorithm and flowchart to solve the problem
• Coding – Writing instructions in a particular programming language to solve a problem
• Program Testing – After writing a program, programmers need to test the program for completeness, correctness, reliability
and maintainability. We can perform: Unit Testing, Program Testing, Verification Testing and Validation Testing
• Installation and Maintenance – Act of making the program ready for execution and maintenance means periodic review of
the program and modifications based on user requirements
07/28/2025 Python Programming - KS 5
Introduction to Algorithm
• An algorithm is a step by step descriptions of the procedures written in human understandable
language for solving the given problem
• Characteristics of an Algorithm:
• Finite number of steps
• Take input and display outputs
• Must generate correct result if the input is correctly provided
• Advantages of an Algorithm:
• Easy to understand
• Programming language independent
• Makes the problem simple, clear and correct
07/28/2025 Python Programming - KS 6
Examples
Algorithm to find the largest number among three numbers: Step 5: Stop
Step 1: Start Algorithm to find sum of two numbers:
Step2: Input value a,b,c
Step 1: Start
Step 3: if a>b and a>c then display a is greater
Step 2 : Input two number a and b
Else if b>a and b>c then display b is
greater Step 3 : Calculate sum = a+b
Else display c is greater Step 4: Display sum
Step 4: Stop Step 5: Stop
Algorithm to find simple interest:
Step 1: Start
Class-Work
Step 2: Input p,t,r
Algorithm to find sum and average of n natural
Step 3 : Calculate I = (p*t*r)/100
numbers??
Step 4: Display I
07/28/2025 Python Programming - KS 7
Practice Questions
Write an algorithm to add, multiply, subtract and Algorithm to determine whether the given triangle
divide given two numbers is isosceles or not
Algorithm to find the area of rectangle and circle Algorithm to determine whether the given number
is positive or not
Algorithm to find the price of n mangoes given the price
of a dozen mangoes
Algorithm to convert meter into centimeter and gram
in kilogram
Algorithm to find sum of first two and last two digits of
a 4 digits number
Algorithm to determine whether the given number is
even or odd
07/28/2025 Python Programming - KS 8
Introduction to Flowchart
• A flowchart is a step by step diagrammatic representation of the logic paths to solve a given
problem
• It is a graphical representation of an algorithm
• Advantages:
• Shows the logic of a problem displayed in a pictorial fashion
• Program could be coded efficiently using flowcharts
• It is a good means of communication to other users
• Disadvantages:
• It is not useful to represent complex program logic
• For any alterations, the flowcharts have to be redrawn completely
07/28/2025 Python Programming - KS 9
Introduction to Flowchart
• Rules for writing flowcharts:
• The flowcharts should be clear, neat and easy to follow
• It should be drawn from top to bottom
• A flowchart always begins with start symbol and ends with stop symbol
• Flow lines are used to join the symbols
• Decision box should have one entry point and two exit points
• For lengthy flowcharts, connectors are used to join them
07/28/2025 Python Programming - KS 10
Symbols used in Flowcharts
07/28/2025 Python Programming - KS 11
Design (Flowchart)
Begin
Read Value1,
Value2
Calculate
Sum = Value1 + Value2
Display
Sum
End
07/28/2025 Python Programming - KS 12
Design (Flowchart)
Begin
Read Amount
YES NO
Amount>20.00?
Calculate Calculate
Actual=Amount * 0.80 Actual=Amount
End
07/28/2025 Python Programming - KS 13