## Saturday 24 August 2024

### Python Tutorial - 1 - Class 11 Computer Science - Introduction to Problem-Solving

Introduction to Problem-Solving

Problem and Problem Solving

In computer science, "problem" refers to a task or challenge that requires a solution. The process of identifying a problem, developing an algorithm, and implementing the algorithm to develop a computer program is called Problem Solving. Computers may be used to solve various daily life problems such as Train Ticket Booking, Online Shopping and Net-Banking etc.

Steps required for solving a problem

·        Analysing the problem

·        Developing an Algorithm

·        Coding

·        Testing and Debugging

Analyzing the Problem

This stage focuses on understanding the problem. If we do not have a clear understanding of the problem, we may develop a computer program that cannot solve the problem correctly. In this stage, we figure out the inputs, the outputs and the processing required to convert the input into the output.

Developing Algorithm

This stage focuses on creating a logical sequence of instructions, called an Algorithm. An algorithm has a distinct start and end point, as well as a defined number of steps. For a given problem, more than one algorithm may be possible and the most suitable algorithm may be chosen.

Algorithm for finding whether a number is Even or Odd

START

Step 1 → Take an integer number A

Step 2 → Divide A by 2, and store the remainder as r

Step 3 → If r is equal to 0, A is an Even Number

Step 4 → Else it is an Odd Number

STOP

Algorithm for finding whether a number is a Prime number or Not

START

Step 1 → Take an integer number A

Step 2 → Continuously divide A with integers ranging from 2 to A-1

Step 3 → If a is divisible by any value from 2 to A-1, it is not prime

Step 4 → Else it is prime

STOP

Coding

Coding is the process of creating computer programs.

Testing

Testing is a process to check if an application is working as expected (and not working abnormally). The main objective of Testing is to find errors.

Debugging

Debugging is the activity to fix the errors found in the application during the testing phase.

Representation of Algorithms

There are two common methods of representing an algorithm —flowchart and pseudocode.