Python Programming: Algorithms, Paradigms, IDEs, and Coding Standards
VerifiedAdded on  2024/05/21
|39
|4032
|148
Report
AI Summary
This Python programming assignment details the development of a console application using the Python language and the IDLE IDE. The documentation includes algorithm definitions for various tasks, a flowchart outlining the application process, and a discussion of programming paradigms such as object-oriented, procedural, and event-driven programming. The report presents source code and output screenshots, followed by an examination of the debugging process within IDLE and the coding standards employed during application development. The assignment explores topics such as defining basic algorithms, explaining programming paradigms, implementing algorithms in code, and determining the debugging process, with a focus on creating a functional and well-documented Python application.

PROGRAMMING ASSIGNMENT
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Table of Contents
List of figures..............................................................................................................................................3
Introduction.................................................................................................................................................4
LO1 Define basic algorithms to carry out an operation and outline the process of programming an
application...................................................................................................................................................5
Algorithms..............................................................................................................................................5
Process outline.......................................................................................................................................8
M1.........................................................................................................................................................10
LO2 Explain the characteristics of procedural, object-orientated and event-driven programming, conduct
an analysis of a suitable Integrated Development Environment (IDE)......................................................11
M2.........................................................................................................................................................13
LO3 Implement basic algorithms in code using an IDE............................................................................15
M3.........................................................................................................................................................30
LO4 Determine the debugging process and explain the importance of a coding standard.........................31
Debugging process in IDLE IDE........................................................................................................31
Coding standard used in code.............................................................................................................34
M4.........................................................................................................................................................36
Conclusion.................................................................................................................................................37
References.................................................................................................................................................38
List of figures..............................................................................................................................................3
Introduction.................................................................................................................................................4
LO1 Define basic algorithms to carry out an operation and outline the process of programming an
application...................................................................................................................................................5
Algorithms..............................................................................................................................................5
Process outline.......................................................................................................................................8
M1.........................................................................................................................................................10
LO2 Explain the characteristics of procedural, object-orientated and event-driven programming, conduct
an analysis of a suitable Integrated Development Environment (IDE)......................................................11
M2.........................................................................................................................................................13
LO3 Implement basic algorithms in code using an IDE............................................................................15
M3.........................................................................................................................................................30
LO4 Determine the debugging process and explain the importance of a coding standard.........................31
Debugging process in IDLE IDE........................................................................................................31
Coding standard used in code.............................................................................................................34
M4.........................................................................................................................................................36
Conclusion.................................................................................................................................................37
References.................................................................................................................................................38

List of figures
Figure 1 Process outline............................................................................................................................10
Figure 2 IDLE environment.......................................................................................................................14
Figure 3 Source code (part 1)....................................................................................................................15
Figure 4Source code (part 2).....................................................................................................................16
Figure 5Source code (part 3).....................................................................................................................17
Figure 6Source code (part 4).....................................................................................................................18
Figure 7Source code (part 5).....................................................................................................................19
Figure 8Source code (part 6).....................................................................................................................20
Figure 9Source code (part 7).....................................................................................................................21
Figure 10Source code (part 8)...................................................................................................................22
Figure 11Source code (part 9)...................................................................................................................23
Figure 12 Menu system.............................................................................................................................23
Figure 13 Output of task 1.1......................................................................................................................24
Figure 14Output of task 1.2.......................................................................................................................24
Figure 15Output of task 1.3.......................................................................................................................25
Figure 16Output of task 1.4.......................................................................................................................25
Figure 17Output of task 1.5.......................................................................................................................26
Figure 18Output of task 1.6.......................................................................................................................26
Figure 19Output of task 1.7.......................................................................................................................27
Figure 20Output of task 1.8.......................................................................................................................27
Figure 21Output of task 1.9.......................................................................................................................28
Figure 22Output of task 1.10.....................................................................................................................28
Figure 23 Grade validation........................................................................................................................29
Figure 24 Speed validation........................................................................................................................29
Figure 25 Time validation.........................................................................................................................30
Figure 26 Step 1........................................................................................................................................31
Figure 27 Step 2........................................................................................................................................32
Figure 28 Step 3........................................................................................................................................33
Figure 29 Step 7........................................................................................................................................34
Figure 30 Coding convention 1.................................................................................................................35
Figure 31 Coding convention 2.................................................................................................................35
Figure 32 Coding convention 3.................................................................................................................36
Figure 33 Coding convention 4.................................................................................................................36
Figure 1 Process outline............................................................................................................................10
Figure 2 IDLE environment.......................................................................................................................14
Figure 3 Source code (part 1)....................................................................................................................15
Figure 4Source code (part 2).....................................................................................................................16
Figure 5Source code (part 3).....................................................................................................................17
Figure 6Source code (part 4).....................................................................................................................18
Figure 7Source code (part 5).....................................................................................................................19
Figure 8Source code (part 6).....................................................................................................................20
Figure 9Source code (part 7).....................................................................................................................21
Figure 10Source code (part 8)...................................................................................................................22
Figure 11Source code (part 9)...................................................................................................................23
Figure 12 Menu system.............................................................................................................................23
Figure 13 Output of task 1.1......................................................................................................................24
Figure 14Output of task 1.2.......................................................................................................................24
Figure 15Output of task 1.3.......................................................................................................................25
Figure 16Output of task 1.4.......................................................................................................................25
Figure 17Output of task 1.5.......................................................................................................................26
Figure 18Output of task 1.6.......................................................................................................................26
Figure 19Output of task 1.7.......................................................................................................................27
Figure 20Output of task 1.8.......................................................................................................................27
Figure 21Output of task 1.9.......................................................................................................................28
Figure 22Output of task 1.10.....................................................................................................................28
Figure 23 Grade validation........................................................................................................................29
Figure 24 Speed validation........................................................................................................................29
Figure 25 Time validation.........................................................................................................................30
Figure 26 Step 1........................................................................................................................................31
Figure 27 Step 2........................................................................................................................................32
Figure 28 Step 3........................................................................................................................................33
Figure 29 Step 7........................................................................................................................................34
Figure 30 Coding convention 1.................................................................................................................35
Figure 31 Coding convention 2.................................................................................................................35
Figure 32 Coding convention 3.................................................................................................................36
Figure 33 Coding convention 4.................................................................................................................36
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Introduction
This assessment is based on the Python programming language. In this assignment, a driven console
application will develop. The application will be developed using programming language python and
using IDLE IDE. A documentation part will also be carried for this assignment in which the first section
will discuss the algorithm of the application. A flow chart will also make to discuss the outline process of
application. In next section of the report, the discussion will be carried out for different paradigms like
object-oriented paradigm, procedural paradigm,and event-driven paradigm. In next section, the report will
include the source code screenshots and output screenshots. In the last section of the report, a discussion
will be carried out for debugging process in IDLE and the coding standard that will be followed to
develop the application.
This assessment is based on the Python programming language. In this assignment, a driven console
application will develop. The application will be developed using programming language python and
using IDLE IDE. A documentation part will also be carried for this assignment in which the first section
will discuss the algorithm of the application. A flow chart will also make to discuss the outline process of
application. In next section of the report, the discussion will be carried out for different paradigms like
object-oriented paradigm, procedural paradigm,and event-driven paradigm. In next section, the report will
include the source code screenshots and output screenshots. In the last section of the report, a discussion
will be carried out for debugging process in IDLE and the coding standard that will be followed to
develop the application.
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

LO1 Define basic algorithms to carry out an operation and outline the process
of programming an application
Algorithms
An algorithm is known as formula or procedure to perform any task. It contains a list of specified steps to
perform the task. The algorithm can be termed as a small procedure to do any task. Algorithms are used to
perform data processing, calculation, and automated tasks. Algorithms are expressed infinite amount of
time and space. Basically, the algorithm can be termed as a formal language to calculate any function
(Bean, n.d.).
In this section the algorithms for the different task are mentioned here:
Algorithm for task 1.1:
a. Program starts.
b. Define function wish () for task 1.1.
c. Take input from user i.e. username and time.
d. Apply exception handling code to prevent code form exceptions.
e. Print the message according to the condition.
f. Print error message if time is in not proper format.
g. Program ends.
Algorithm for task 1.2
a. Program starts.
b. Define the function printUserName () for task 1.2.
c. Print the name pattern using print.
d. Program ends.
Algorithm for task 1.3
a. Program starts.
b. Define the function calculateRectangle1 () for task 1.3.
c. Take input from user i.e. length and width.
d. The calculateRectangle method is called.
of programming an application
Algorithms
An algorithm is known as formula or procedure to perform any task. It contains a list of specified steps to
perform the task. The algorithm can be termed as a small procedure to do any task. Algorithms are used to
perform data processing, calculation, and automated tasks. Algorithms are expressed infinite amount of
time and space. Basically, the algorithm can be termed as a formal language to calculate any function
(Bean, n.d.).
In this section the algorithms for the different task are mentioned here:
Algorithm for task 1.1:
a. Program starts.
b. Define function wish () for task 1.1.
c. Take input from user i.e. username and time.
d. Apply exception handling code to prevent code form exceptions.
e. Print the message according to the condition.
f. Print error message if time is in not proper format.
g. Program ends.
Algorithm for task 1.2
a. Program starts.
b. Define the function printUserName () for task 1.2.
c. Print the name pattern using print.
d. Program ends.
Algorithm for task 1.3
a. Program starts.
b. Define the function calculateRectangle1 () for task 1.3.
c. Take input from user i.e. length and width.
d. The calculateRectangle method is called.

e. The calculateRectangle calculate perimeter and area of the rectangle.
f. The perimeter and area of rectangle prints.
g. Program ends.
Algorithm for task 1.4
a. Program starts.
b. Define the function arrivalTime1 () in task 1.4.
c. Take user from input i.e. average speed.
d. Call the method arrivalTime ().
e. The condition is a check that average speed is greater than 14 or not.
f. If average speed is less than 14 than arrivalTime1() method is called.
g. If average speed is greater than 14 then arrival time is calculated.
h. The arrival time is calculated and return in format hh: mm.
i. The arrival time is printed.
j. Program ends.
Algorithm for task 1.5.
a. Program starts.
b. Define the function results () for task 1.5.
c. Take user input i.e. name of student and grade.
d. Check grade if it is less than 0 or greater than 100 and if condition violates error message prints.
e. If the grade is greater than 0 and less than 100 the condition is checked for grade and assign result
according to grade.
f. Calculate the average of grade by dividing total grade by a number of students.
g. Print student name, grade, result and average grade.
h. Program ends.
Algorithm for task 1.6.
a. Program starts.
b. Define the function generateRandomNumber () for task 1.6.
c. Define the array to store random number.
d. Generate the random number using randint function between 1 to 79.
e. Store generated a random number into an array.
f. Print random numbers.
f. The perimeter and area of rectangle prints.
g. Program ends.
Algorithm for task 1.4
a. Program starts.
b. Define the function arrivalTime1 () in task 1.4.
c. Take user from input i.e. average speed.
d. Call the method arrivalTime ().
e. The condition is a check that average speed is greater than 14 or not.
f. If average speed is less than 14 than arrivalTime1() method is called.
g. If average speed is greater than 14 then arrival time is calculated.
h. The arrival time is calculated and return in format hh: mm.
i. The arrival time is printed.
j. Program ends.
Algorithm for task 1.5.
a. Program starts.
b. Define the function results () for task 1.5.
c. Take user input i.e. name of student and grade.
d. Check grade if it is less than 0 or greater than 100 and if condition violates error message prints.
e. If the grade is greater than 0 and less than 100 the condition is checked for grade and assign result
according to grade.
f. Calculate the average of grade by dividing total grade by a number of students.
g. Print student name, grade, result and average grade.
h. Program ends.
Algorithm for task 1.6.
a. Program starts.
b. Define the function generateRandomNumber () for task 1.6.
c. Define the array to store random number.
d. Generate the random number using randint function between 1 to 79.
e. Store generated a random number into an array.
f. Print random numbers.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

g. Program ends.
Algorithm for task 1.7.
a. Program starts.
b. Define the function sumOfArray() to take elements of the array as input in task 1.7.
c. The sum is calculated of elements of the array and return.
d. The other function defines to pass a value to the function.
e. The sum is printed.
f. Program ends.
Algorithm for task 1.8.
a. Program starts.
b. Define function heightOfBounce() in task 1.8.
c. Take user input i.e. height.
d. The heightOfLevel value is assigned to heightOfDistance.
e. The value of bounceByBall is set to zero.
f. A condition is check in while loop that heightOfDistance is greater than limitOfHeight.
g. The bounceByBall value is incremented by 1 every time.
h. The heightOflevel value is multiplied by 0.7 to calculate heightOfLevel.
i. The number of bounces is printed.
j. Program ends.
The algorithm of task 1.9
a. Program starts.
b. Define function randomQuestionsOfMath () in task 1.9.
c. Take user input i.e. how many questions user wants to calculate.
d. The random number of questions are generated using if else condition.
e. The operands are generated randomly.
f. The user provides the operation answer and if it is incorrect error message will occur.
g. Program ends.
Algorithm for task 1.7.
a. Program starts.
b. Define the function sumOfArray() to take elements of the array as input in task 1.7.
c. The sum is calculated of elements of the array and return.
d. The other function defines to pass a value to the function.
e. The sum is printed.
f. Program ends.
Algorithm for task 1.8.
a. Program starts.
b. Define function heightOfBounce() in task 1.8.
c. Take user input i.e. height.
d. The heightOfLevel value is assigned to heightOfDistance.
e. The value of bounceByBall is set to zero.
f. A condition is check in while loop that heightOfDistance is greater than limitOfHeight.
g. The bounceByBall value is incremented by 1 every time.
h. The heightOflevel value is multiplied by 0.7 to calculate heightOfLevel.
i. The number of bounces is printed.
j. Program ends.
The algorithm of task 1.9
a. Program starts.
b. Define function randomQuestionsOfMath () in task 1.9.
c. Take user input i.e. how many questions user wants to calculate.
d. The random number of questions are generated using if else condition.
e. The operands are generated randomly.
f. The user provides the operation answer and if it is incorrect error message will occur.
g. Program ends.
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Process outline

⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Figure 1 Process outline
The pseudo code of task 1.7.
a. Function def sumOfArray(arg) with argument.
b. For array sum, the loop runs from1 to a range of array and return.
c. The sum is printed using print sum=str(arg).
d. Program ends.
M1
The pseudo code of task 1.8.
a. Function def heightOfBounce() and take height as input.
b. The heightOfDistance>limitOfHeight and a number of bounce are incremented by 1.
c. The heightOfDistance is multiplied by 0.7.
d. Program ends.
The pseudo code of task 1.7.
a. Function def sumOfArray(arg) with argument.
b. For array sum, the loop runs from1 to a range of array and return.
c. The sum is printed using print sum=str(arg).
d. Program ends.
M1
The pseudo code of task 1.8.
a. Function def heightOfBounce() and take height as input.
b. The heightOfDistance>limitOfHeight and a number of bounce are incremented by 1.
c. The heightOfDistance is multiplied by 0.7.
d. Program ends.
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

LO2 Explain the characteristics of procedural, object-orientated and event-
driven programming, conduct an analysis of a suitable Integrated
Development Environment (IDE)
Explain procedure, oops, event-driven programming
Python programming language is widely used for programming purpose as the language is very flexible.
Python programming language has many advantages over many other programming languages. The
advantages of language have potential to reduce the errors and helps to improve the developer’s
efficiency. There are three different paradigms for python programming language i.e. procedural, object-
orientated and event-driven paradigms. These paradigms help the programmers to develop an effective
and efficient application. These paradigms need to be implemented in an application which helps to
develop an easy application.
1. Procedural paradigms
The procedural programming paradigm is deriving from the structured programming which relies
on a procedure call. The other name of the procedure is routines or functions. The procedural call
means series of steps need to perform any function. The procedures can be called in between the
program execution and at the same time procedures can call itself. The examples of a procedural
programming language are PASCAL, C, COBOL, and python. The procedural programming
language is completely dependent on procedures calls which are required to create the
modularized codes. The procedural programming language helps to break down the program into
small pieces which help the developer to understand and manage the code. The procedural
programming language helps to perform step by step execution of the program. In a procedural
programming language, the developer tries to manage code as precise as possible. As the
procedural programming language tries to break the program into small pieces which are called
procedures or functions the large complex program can be write down in a procedural
programming language. The Python programming language uses the procedural programming
language paradigm and uses functions to reduce the complexity of the program. There are
numerous advantages of a procedural programming language like it can help to reuse the code as
the code is segmented into functions, the logic of program can easily be understood, the code is
easily maintainable as the procedural programming language helps to reduce the complexity of
driven programming, conduct an analysis of a suitable Integrated
Development Environment (IDE)
Explain procedure, oops, event-driven programming
Python programming language is widely used for programming purpose as the language is very flexible.
Python programming language has many advantages over many other programming languages. The
advantages of language have potential to reduce the errors and helps to improve the developer’s
efficiency. There are three different paradigms for python programming language i.e. procedural, object-
orientated and event-driven paradigms. These paradigms help the programmers to develop an effective
and efficient application. These paradigms need to be implemented in an application which helps to
develop an easy application.
1. Procedural paradigms
The procedural programming paradigm is deriving from the structured programming which relies
on a procedure call. The other name of the procedure is routines or functions. The procedural call
means series of steps need to perform any function. The procedures can be called in between the
program execution and at the same time procedures can call itself. The examples of a procedural
programming language are PASCAL, C, COBOL, and python. The procedural programming
language is completely dependent on procedures calls which are required to create the
modularized codes. The procedural programming language helps to break down the program into
small pieces which help the developer to understand and manage the code. The procedural
programming language helps to perform step by step execution of the program. In a procedural
programming language, the developer tries to manage code as precise as possible. As the
procedural programming language tries to break the program into small pieces which are called
procedures or functions the large complex program can be write down in a procedural
programming language. The Python programming language uses the procedural programming
language paradigm and uses functions to reduce the complexity of the program. There are
numerous advantages of a procedural programming language like it can help to reuse the code as
the code is segmented into functions, the logic of program can easily be understood, the code is
easily maintainable as the procedural programming language helps to reduce the complexity of

the code. A procedural programming language is known as sub-paradigm of the imperative
programming language. The other name for a procedural programming language is top-down
languages. A procedural programming language is intuitive language as it can depict the behavior
of a program as the steps are mentioned earlier before implementation.A procedural programming
paradigm is dependent on procedures which operate on data which helps to develop a complex
application using less line of code(MacDonald, 2014).
2. Object-oriented paradigm
The object-oriented programming language is a type of programming paradigm which helps to
structure the program so that the behaviors and properties can be bundled in individual objects.
The object-oriented programming language is used to perform different functions by modeling
the concrete real world things. The object-oriented programming language is dependent on the
objects which are used to represent the data and the complete structure of the program. The
object-oriented programming language helps to increase the ability of the applications so that
code can be reuse and helps to better understand the code. In an object-oriented programming
language, there are two more paradigms attached i.e. encapsulation and inheritance. The
inheritance helps to reuse the code and the encapsulation helps to hide the inner working of code
and make the application easy to understand. In python programming language classes are
created which have associated objects. In python, the classes are created so that user-defined data
structure can be used which can contain some arbitrary information. The classes are only the
logical structure of program it does not has any physical existence, the objects have a real
existence in the program. The objects in python programming language contain characteristics
which are called attributes. The classes in Python programming language are created using the
keyword class and the objects are initialized using the init() method by passing some default
value. The methods are also created in the object-oriented programming language to get content
of the instance. The methods are called instance methods as these methods are associated with the
objects and these methods are used to get the information using the objects of the class. Python
supports different paradigms like inheritance and overriding. Inheritance means when one class
inherits all methods and attributes of other class. The child class extends the parent class to
acquire the attributes and methods of the parent class (Beal, n.d.).
3. Event-driven paradigm
Event-driven paradigm is the type of programming paradigm which is used at the time of event
occur. Events can be of any type like keyboard click or mouse clicks. The event-driven paradigm
helps the programmer to develop the applications as there are two stages required in developing
an application i.e. the event which occurs and the action which happens after the occurrence of an
programming language. The other name for a procedural programming language is top-down
languages. A procedural programming language is intuitive language as it can depict the behavior
of a program as the steps are mentioned earlier before implementation.A procedural programming
paradigm is dependent on procedures which operate on data which helps to develop a complex
application using less line of code(MacDonald, 2014).
2. Object-oriented paradigm
The object-oriented programming language is a type of programming paradigm which helps to
structure the program so that the behaviors and properties can be bundled in individual objects.
The object-oriented programming language is used to perform different functions by modeling
the concrete real world things. The object-oriented programming language is dependent on the
objects which are used to represent the data and the complete structure of the program. The
object-oriented programming language helps to increase the ability of the applications so that
code can be reuse and helps to better understand the code. In an object-oriented programming
language, there are two more paradigms attached i.e. encapsulation and inheritance. The
inheritance helps to reuse the code and the encapsulation helps to hide the inner working of code
and make the application easy to understand. In python programming language classes are
created which have associated objects. In python, the classes are created so that user-defined data
structure can be used which can contain some arbitrary information. The classes are only the
logical structure of program it does not has any physical existence, the objects have a real
existence in the program. The objects in python programming language contain characteristics
which are called attributes. The classes in Python programming language are created using the
keyword class and the objects are initialized using the init() method by passing some default
value. The methods are also created in the object-oriented programming language to get content
of the instance. The methods are called instance methods as these methods are associated with the
objects and these methods are used to get the information using the objects of the class. Python
supports different paradigms like inheritance and overriding. Inheritance means when one class
inherits all methods and attributes of other class. The child class extends the parent class to
acquire the attributes and methods of the parent class (Beal, n.d.).
3. Event-driven paradigm
Event-driven paradigm is the type of programming paradigm which is used at the time of event
occur. Events can be of any type like keyboard click or mouse clicks. The event-driven paradigm
helps the programmer to develop the applications as there are two stages required in developing
an application i.e. the event which occurs and the action which happens after the occurrence of an
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 39
Related Documents
Your All-in-One AI-Powered Toolkit for Academic Success.
 +13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.




