Algorithm Analysis and Implementation in Python using IDLE

Verified

Added on  2025/04/29

|26
|3553
|239
AI Summary
Desklib provides past papers and solved assignments for students. This report details algorithm implementation and debugging in Python.
Document Page
BJ CW Programming
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Table of Contents
BJ CW Programming.......................................................................................................................1
List of Figure...................................................................................................................................3
List of Table.....................................................................................................................................3
Introduction......................................................................................................................................4
LO1 Define basic algorithms to carry out an operation and outline the process of programming
an application...................................................................................................................................5
P1 Provide a definition of what an algorithm is and outline the process in building an
application....................................................................................................................................5
M1 Determine the steps taken from writing code to execution...................................................6
LO2: Explain the characteristics of procedural, object-orientated and event-driven programming,
conduct an analysis of a suitable Integrated Development Environment (IDE)...........................11
P2 Give explanations of what procedural, object-orientated and event-driven paradigms are;
their characteristics and the relationship between them............................................................11
M2 Analyse the common features that a developer has access to in an IDE............................13
LO3 Implement basic algorithms in code using an IDE................................................................15
P3 Write a program that implements an algorithm using an IDE..............................................15
Program Code or Source Project Code for this given Problem.................................................16
M3 Use the IDE to manage the development process of the program......................................17
LO4 Determine the debugging process and explain the importance of a coding standard...........21
P4 explain the debugging process and explain the debugging facilities available in the IDE.. 21
P5 Outline the coding standard you have used in your code.....................................................22
M4 Evaluate how the debugging process can be used to help develop more secure, robust
applications................................................................................................................................22
Conclusion.....................................................................................................................................24
References......................................................................................................................................25
Document Page
List of Figure
Figure 1: Opening a New Project on IDLE.....................................................................................5
Figure 2: Saving a File.....................................................................................................................6
Figure 3: Writing the Code..............................................................................................................7
Figure 4: Running a Program.........................................................................................................8
Figure 5: Output Shell Window.......................................................................................................8
Figure 6: Opening a New Project on IDLE...................................................................................16
Figure 7: Saving a File...................................................................................................................17
Figure 8: Writing the Code............................................................................................................18
Figure 9: Running a Program........................................................................................................19
Figure 10: Output Shell Window...................................................................................................19
List of Table
Table 1: Difference between Algorithm & Source Code................................................................3
Table 2: Relationship between procedural, object-orientated and event-driven paradigms..........11
Document Page
Introduction
This assignment is containing the algorithm assessment with source code or project code. In LO
1, we have to understand the concept of algorithm and difference between algorithm & source
code. Here, in this we have to also learn how we can implement a algorithm. In LO 2, we have
to understand the different paradigm that is object oriented, event driven and procedural with
their characteristic & similarities and difference also. We have to learn also effective features of
IDE tool. In LO 3, we have to implement the algorithm as well as source code for given problem
that is finding the salary of employee based on the sale with interest rate. In LO 4, it is having
some security aspect and how you have implement this algorithm.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
LO1 Define basic algorithms to carry out an operation and outline the process
of programming an application
P1 Provide a definition of what an algorithm is and outline the process in building
an application.
Algorithm
The algorithm is defined as the process of solving a problem following by step by step which is
mostly used for processing of data or information with performing some calculation based on
mathematical operations. An algorithm is also used for manipulation of information of data in
different aspects with insertion of new information of data or searching a particular data.
An algorithm is also defined as complete series of information which is carried out for creating
the solution of file.
Characteristics of Algorithm
Here, below are some properties of algorithm based on their functionality and these are as
follows:
The statement which are defined into algorithm are precisely.
Please make sure that an algorithm is based on the input and according to input, it will
generate outcome.
It is having stopping stage at which after the complete execution of some instruction it
will break automatically worked as complete task.
When the algorithm is received an input, it will process and generate output (Techopedia,
2019).
Difference between the Algorithm & Source Code
Here, below is the key difference points in between the algorithm & source code for finding the
solution of the problem:
Document Page
Table 1: Difference between Algorithm & Source Code
S.N. Algorithm Program (Source Code)
1. It is defined as the sequence of steps for
finding the solution of any problem.
It is having the set of instruction for
solving the specific task and execution.
2. It is executed by normally computer
programs, however used for mathematical
solution also.
Program is having high level language
which is converted into machine level
language, understand by machine.
3. It is having only logic with steps which are
required for solution
It is having some specific syntax &
semantics with logic also.
4. Example:
If L is of length 1, return the first item of L.
Set v1 to the first item of L.
Set v2 to the output of performing find_max
() on the rest of L.
If v1 is larger than v2, return v1. Otherwise,
return v2.
Example:
def find_max (L):
if len (L) == 1:
return L[0]
v1 = L[0]
v2 = find_max (L[1:])
if v1 > v2:
return v1
else:
return v2
M1 Determine the steps taken from writing code to execution.
Here, below is the steps which are taken for solving the given problem which is from the
initiation of project up to execution of task and these are as follows:
For any algorithm, understand the requirement of problem and note down what
things which are given already are and what we have to find out.
After that generate the steps for finding the solution named as algorithm.
Document Page
On the completion of algorithm, please install the IDLE software for python which
is full formed as Integrated Development Environment and it is GUI (Graphical User
Interface) for python programming.
After that, please set the environment for this IDE.
After that open the IDLE Python (GUI) and start a new project.
Figure 1: Opening a New Project on IDLE
For starting a new project please click on file option and after that select new file and
save it with filename.py extension.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Figure 2: Saving a File
After that a coding or programming screen will be opened.
Now, you have to write your code here with maintaining the logics & syntax also.
Document Page
Figure 3: Writing the Code
After that save and compile the program and click on run.
Document Page
Figure 4: Running a Program
When you click on run a window will be opened name python GUI shell and here is
outcome of program.
Figure 5: Output Shell Window
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
LO2: Explain the characteristics of procedural, object-orientated and event-
driven programming, conduct an analysis of a suitable Integrated
Development Environment (IDE)
P2 Give explanations of what procedural, object-orientated and event-driven
paradigms are; their characteristics and the relationship between them.
Relationship between procedural, object-orientated and event-driven paradigms
Procedural Paradigm
It is defined as programming model which is followed by machine mode. In this, we are having
ability for reusing the source code. It is using the character user interface for using the
commands for development or writing the program code or source code. Most famous language
which are followed by this model are as Basic Fortran and COBOL.
Characteristic of Procedural Paradigm
Here, commands are written in linear manner or fashion and execution of program is also
followed in linear manner or fashion.
Its main focus is having the selection of statements written in code for execution of
program in sequence manner.
It is having the ability for reusing the source code.
It is using the character user interface for using the commands for development or writing
the program code or source code
Example – FORTRAN & COBOL.
Object Oriented
In this, source code is written as the collection of classes & objects for communication to
generate the outcome. All the computational part is performed by objects only. It is completely
based on the real life scenario with maintaining the security of information or data, inheritance,
reusability feature of code and data abstraction & encapsulation also.
Document Page
Characteristic of Object Oriented
It is using the commands which is used for the development or writing the program code
or source code.
Its main focus is on the objects with their data for secure facilitation after completion of
authorized accessibility.
In this, classes & objects with their functions are developed for interacting the specific
tasks and performing operations also.
Example: JAVA, C ++, Visual Basic .NET, Python & Ruby
Event Driven
This is a type of programming language which is based on the user action that is by clicking on
mouse. It can be used via only GUI (Graphical User Interface). It is also used for interacting with
hardware.
Characteristic of Event Driven
It is using the GUI (graphical user interface for developing the program code or source
code.
Actions are depends on the events (Zubair Dadabhai, 2011).
Here, below is the relationship in between procedural, object-orientated and event-driven
paradigms are explained by mentioning the difference and similarities between them and these
are as follows:
Table 2: Relationship between procedural, object-orientated and event-driven paradigms
S.N. Procedural Object Oriented Event Driven
1. It is using the character user
interface for using the
commands for development
or writing the program code
or source code.
It is using the commands
which is used for the
development or writing the
program code or source
code.
It is using the GUI
(graphical user interface
for developing the
program code or source
code.
2. Here, commands are written In this, classes & objects Here, actions are
chevron_up_icon
1 out of 26
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]