0% found this document useful (0 votes)
82 views82 pages

XI CS Notes (2025-26) Presentation

The document outlines the fundamentals of problem-solving in computer science, detailing the problem-solving cycle, which includes analyzing the problem, designing a solution, and implementing it. It emphasizes the importance of programming methodology, characteristics of good programming, and the stages of program development, alongside an introduction to Python programming language and its features. Additionally, it provides a step-by-step guide for installing Python and highlights the differences between interactive and script modes.

Uploaded by

samalpranav
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)
82 views82 pages

XI CS Notes (2025-26) Presentation

The document outlines the fundamentals of problem-solving in computer science, detailing the problem-solving cycle, which includes analyzing the problem, designing a solution, and implementing it. It emphasizes the importance of programming methodology, characteristics of good programming, and the stages of program development, alongside an introduction to Python programming language and its features. Additionally, it provides a step-by-step guide for installing Python and highlights the differences between interactive and script modes.

Uploaded by

samalpranav
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
You are on page 1/ 82

XI Computer Science (2025-26)

Programming Methodology

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 1
Problem Solving
• What is Problem?
Problems are at the center of what many
people do at work every day.
Problem Solving Cycle:
There are 3 basic steps for solving any
problem using computer / computer
program.
1. Analyze / Define problem
2. Design solution (developing an
algorithm, coding, testing and debugging)
3. Implement solution.
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 2
1. Analyze / Define problem:
The process of understanding the problem and then defining it on the basis of
following:
• Data requirement of the given problem.
• Type of input variable required
• Type of output variable required is called problem definition.
2. Design solution (developing an algorithm, coding, testing and debugging):
• Design is the process to transform user requirements into some suitable form, which
helps the programmer in software coding and implementation.
• Programmed tools, program design tools are the tools used to develop a program,
following are some of them
Algorithm
Flowchart
Pseudo-code
• An algorithm is a plan, a logical step-by-step process for solving a problem.
Algorithms are normally written as a flowchart or in pseudo-code as it’s next level.
• When designing an algorithm there are two main areas to look at:
• The big picture – what is the final goal?
• The individual stages – what hurdles need to be overcome on the way to the goal?
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 3
Problem Solving

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 4
Problem Solving

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 5
Problem Solving

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 6
Problem Solving

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 7
Algorithm

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 8
Algorithm

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 9
Flow chart

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 10
IPO, Flow chart & Algorithm - Division of two numbers

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 11
Pseudo code & Keywords of Pseudo code

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 12
IPO, Algorithm & Pseudo code
Display square of a given number

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 13
Pseudo code

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 14
Flow of Control

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 15
Selection Constructs

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 16
Algorithm, Pseudo code & Flow chart - Larger of two numbers

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 17
Selection Constructs

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 18
Algorithm, Pseudo code & Flow chart - Largest of three numbers

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 19
Iterative Constructs

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 20
Algorithm for display a message 10 times

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 21
Pseudo code & Flow chart of displaying a message 10 times

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 22
Pseudo code for sum of 10 numbers

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 23
Pseudo code – Factorial of a number

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 24
Flow chart – Factorial of a Number

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 25
Decomposition

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 26
Programming Methodology
Programming is all about solving a particular problem through computerized
codes.
Example: Inventory management at any shopping complex, marks evaluation
of OMR sheets, running of a remote car, or even running of a missile.
Scope of programming ranges from very simpleton tasks to extremely
complicated ones.
Common parameter is to handle and solve the problem efficiently.
One can’t learn to fly an aero plane simply by watching it flying, one has to
actually learn it.
Similarly to become a proficient coder, one has to actually do the codes.
Task of coding is extremely easy once one learns how to apply the logic for
problem solving.

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 27
Fundamental Entities of Computer Programming
Writing
• Writing involves writing down on a paper what is the desired output of the code. This can easily be
done by drawing a flowchart which depicts all the steps involved from starting to end.

Testing
• Testing is the process to check whether the program has any error or not

Trouble Shooting
• Once tested, if there are some errors, then those errors have to be removed. This process is
called troubleshooting.

Debugging
• To determine the exact location of the error in the code is executed through a process called
debugging.

Maintaining
• After successful completion of all these steps, the program is being executed to obtain the
7/15/2025
desired result.Prepared
This is by
called running the program.
Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 28
What is an efficient or good program ?

• A program is called an efficient program only if it gives correct output


corresponding to every input, including the wrong input.
• A good program is one which produces faster and accurate results
and should occupy less space in the computer memory.

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 29
Characteristics of Good Programming
Programming is all about solving a particular problem through computerized
codes.
Example: Inventory management at any shopping complex, marks evaluation
of OMR sheets, running of a remote car, or even running of a missile.
Scope of programming ranges from very simpleton tasks to extremely
complicated ones.
Common parameter is to handle and solve the problem efficiently.
One can’t learn to fly an aero plane simply by watching it flying, one has to
actually learn it.
Similarly to become a proficient coder, one has to actually do the codes.
Task of coding is extremely easy once one learns how to apply the logic for
problem solving.

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 30
Fundamental Entities of Computer Programming
Flexibility
• It should be possible to accommodate modifications in the program without having the requirement to write the entire
code again. For instance, CAD (Computer Aided Design) software - engineering drafting, industrial art, fabric designing,
printing circuit layout and designing, architectural drawing etc

User-Friendly
• User friendly programs are those programs which can easily be understood by a beginner. The interaction between user
and program should be easy to understand. The commands in the program like to input data, to print result, etc. must
easily be comprehensible by the naive user.

Portability
• The ability of a program to run on different operating systems without having any or minimum changes is termed as the
portability of the program or application.

Reliability
• The ability of a program to handle exceptions of wrong input or no input is one of the fundamental behaviors which
define reliability. Although, the program is not expected to produce correct result in these exceptions but it should be
able enough to provide an error message.

Self-Documenting Code
• A self-documenting code is the source code, in which suitable names for the identifiers are being used.
Proper names for the identifiers makes it easier for the user to understand the functionality of a particular
variable or consonant (identifier).
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 31
Stages of Program Development Process:
Analysis
• All the requirements of the program are gathered and the problem is cracked down. An
algorithm is formulated which gives the solution for the problem.

Design
• A Model is developed . This phase gives the face to the program.

Coding
• Algorithm is translated into the program called source code using some programming language.

Compilation
• Issue a compile command against source, and fix any compile errors that arise.

Execution
• An error free program after compilation is put to run to produce the output. This phase is called
run-time, the phase of program execution during which program instructions are carried out.
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 32
Python Programming Language
Developed by Guido Van Rossum in early 1990s.
Very popular language among beginners as well as developers.

• Python is Interpreted − Python is processed at runtime by the interpreter without


the need of compiling program before executing it. This is similar to PERL and PHP.
• Python is Interactive − You can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.
• Python is Object-Oriented − Python supports Object-Oriented style or technique of
programming that encapsulates code within objects.
• Python is a Beginner's Language − Python is a great language for the beginner-level
programmers and supports the development of a wide range of applications from
simple text processing to WWW browsers to games.
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 33
Python Features
Easy to Learn, Read and Maintain
• Python has few keywords, simple structure, and a clearly defined syntax, Python code is more clearly
defined and visible to the eyes and is fairly easy-to-maintain.
Broad Standard Library
• Portable and cross-platform library compatible on UNIX, Windows, and Macintosh.
Interactive Mode
• Python has support for an interactive mode which allows interactive testing and debugging of snippets of
code.
Portable
• Python can run on a wide variety of hardware platforms and has the same interface on all platforms.
Extendable
• Adding Low-level modules to the Python interpreter enable programmers to add to or customize their
tools to be more efficient.
Databases
• Python provides interfaces to all major commercial databases.
GUI Programming
• Python supports GUI applications that can be created and ported to many system calls, libraries and
windows systems, such as Windows MFC, Macintosh, and the X Window system of Unix.
Scalability
• Python provides aPrepared
better structure and support for large programs than shell scripting.
by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS
7/15/2025 34
Getting started with Python
www.python.org
• Python is Interpreted − Python is processed at runtime by the interpreter without
the need of compiling program before executing it. This is similar to PERL and PHP.
• Python is Interactive − You can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.
• Python is Object-Oriented − Python supports Object-Oriented style or technique of
programming that encapsulates code within objects.
• Python is a Beginner's Language − Python is a great language for the beginner-level
programmers and supports the development of a wide range of applications from
simple text processing to WWW browsers to games.
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 35
Python Installation Procedure

Step 1: Open Web browser


www.python.org
Step 2: Select Version of Python to Install.
Step 3: Download Python Executable
Installer - Let suppose, we choose the
Python 3.9.1 version.
On clicking download, various available
executable installers shall be visible with
different operating system specifications.
Choose the installer which suits your
system operating system and download
the installer. Let suppose, we select the
Windows installer (64 bits).
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 36
Python Installation Procedure

Step 4: We downloaded the Python


3.9.1 Windows 64 bit installer. Run
the installer. Make sure to select
both the checkboxes at the bottom
and then click Install New.

On Clicking Install Now, the


Installation process start…

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 37
Python Installation Procedure
Step 5: The installation process will take
few minutes to complete and once the
installation is successful, the following
screen is displayed.

Step 6: Verify Python is installed on


windows:
To ensure if Python is successfully installed
on your system. Follow the given steps −
Open the command prompt.
Type ‘python’ and press enter.
The version of the python which you have
installed will be displayed if the python is
successfully
7/15/2025
installedPrepared
on your windows.
by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 38
Features of Python & Programming Terminologies

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 39
Execution Modes of Python Program

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 40
Interactive Mode vs Script Mode of Python Program

Interactive Mode Script / Batch Mode

• Interactive mode is • Batch mode is mainly


a command line used to develop business
shell. If we write a applications. In batch
python program in mode, we can write a
the command line group of python
shell. statements in any one of
• Typically the the following IDLE
interactive mode is editors.
used to test the • File – Select New – Type
features of the script – Save the file with
python, or to run a .py extension & Click Run
smaller script that – Run option or Press F5.
may not be
reusable.

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 41
Keywords in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 42
Identifiers in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 43
Variables & Data types in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 44
Comments & Operators in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 45
Operators in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 46
Arithmetic Operators in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 47
Relational or Comparison Operators in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 48
Logical Operators in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 49
Truth table of Logical Operators in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 50
Flow chart of Logical and Operator

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 51
Flow chart of Logical or Operator

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 52
Flow chart of Logical not Operator

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 53
Assignment & Augmented Assignment Operators

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 54
Membership Operators

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 55
Identity Operators

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 56
Operator Precedence

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 57
Operator Precedence & Associativity

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 58
Operator Precedence and Associativity

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 59
Operator Precedence and Associativity

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 60
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 61
Notion of Data types and Variables
The Datatypes tells a Python compiler what kind of value can hold. Python includes many
in-built data types, for example, string, number, float, etc
Variables are reserved memory locations to store values.
A variable has a name, a type and a value.
Python variables need not be explicitly declared.
The declarations happens automatically when we assign a value to a variable.
We can assign multiple values to multiple variables in a single statement.

Rules for naming variables


1. Variable names can contain a-z, A-Z, 0-9 and ‘_’ (underscore)
2. Variable name should not begin with a digit.
3. Variable names are case-sensitive. It is recommended to use small letters.
4. It should not be a keyword or reserved words such as if, else, print, while, return, def
etc
5. Variable names cannot contain spaces.
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 62
Notion of Data types and Variables
The Datatypes tells a Python compiler what kind of value can hold. Python includes many
in-built data types, for example, string, number, float, etc
Variables are reserved memory locations to store values.
A variable has a name, a type and a value.
Python variables need not be explicitly declared.
The declarations happens automatically when we assign a value to a variable.
We can assign multiple values to multiple variables in a single statement.

Rules for naming variables


1. Variable names can contain a-z, A-Z, 0-9 and ‘_’ (underscore)
2. Variable name should not begin with a digit.
3. Variable names are case-sensitive. It is recommended to use small letters.
4. It should not be a keyword or reserved words such as if, else, print, while, return, def
etc
5. Variable names cannot contain spaces.
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 63
Notion of Data types and Variables

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 64
Single Quote String vs Double Quotes String
The difference between the two is that using double quotes makes it easy to include
apostrophes. If
you type “Don’t touch my phone”, it gives you output as Don’t touch my phone.
If you type ‘Don’t touch my phone’, it gives you Error, because your code runs only
“Don” and terminates your program.

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 65
Use of Triple Quotes in print statement
It helps to store multiple line of values of string.

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 66
Barebones of a program
Elements of a python program.
Expressions – legal combination of symbols that represent a value.

Statements – programming instructions.

Comments – Readable information to clarify the source code. Single Line


comments (#) and Multi-line comments (“””).

Functions – Reusable named code-sections.

Block(s) or suite(s) – Group of statements which are part of another statement or


a function (Intended at same level).
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 67
Variables and Assignments
Variables represent labelled storage locations, whose
values can be manipulated during program run.
To store the Name and mark of a student:
StudName = ‘Raj’
StudMark = 90

StudName ‘Raj’
StudMark 90
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 68
Variables and Assignments
Variables represent labelled storage locations, whose
values can be manipulated during program run.
To store the Name and mark of a student:
StudName = ‘Raj’
StudMark = 90

StudName ‘Raj’
StudMark 90
7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 69
Expressions & Evaluation of Expressions

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 70
Statements in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 71
Input / Output in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 72
Input / Output in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 73
Type Conversion in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 74
Type Conversion in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 75
Type Conversion in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 76
Type Conversion in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 77
Type Conversion in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 78
Debugging & Types of Error in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 79
Syntax Errors in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 80
Logical Errors in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 81
Runtime Errors in Python

7/15/2025 Prepared by Mr. A. RANJITH KUMAR, Head - Department of Computer Science, SJPS 82

You might also like