Python Programming Assignment: Implementing Basic Algorithms and Debugging Techniques

Verified

Added on  2024/06/05

|25
|3030
|304
AI Summary
This report details the implementation of basic algorithms in Python using Visual Studio 2017 IDE. It covers the development of a console application that demonstrates various programming concepts, including procedural, object-oriented, and event-driven paradigms. The report also explores the debugging process and the importance of coding standards, providing insights into the development of robust and efficient software.

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
PROGRAMMING ASSIGNMENT

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Content Table
List of figures:...................................................................................................................................................................... 3
Introduction.......................................................................................................................................................................... 4
LO1 Define basic algorithms to carry out an operation and outline the process of programming an application. 5
M1..................................................................................................................................................................................... 6
Algorithm:............................................................................................................................................................................. 6
LO2 Explain the characteristics of procedural, object-orientated and event-driven programming, conduct an
analysis of a suitable Integrated Development Environment (IDE).............................................................................7
Procedural programming:..........................................................................................................................................7
Object-Oriented Programming:.................................................................................................................................7
Event-driven Programming:.......................................................................................................................................8
M2..................................................................................................................................................................................... 8
LO3 Implement basic algorithms in code using an IDE...............................................................................................10
M3................................................................................................................................................................................... 20
LO4. Determine the debugging process and explain the importance of a coding standard...................................21
Debugging:................................................................................................................................................................21
M4................................................................................................................................................................................... 23
Conclusion......................................................................................................................................................................... 24
References........................................................................................................................................................................ 25
Document Page
List of figures:
Figure 1 Process Outline........................................................................................................................................................5
Figure 2 (Part 1) Source Code......................................................................................................................................10
Figure 3 (Part 2) Source Code.....................................................................................................................................10
Figure 4 (Part 3) Source Code......................................................................................................................................11
Figure 5 (Part 4) Source Code.....................................................................................................................................11
Figure 6 (Part 5) Source Code......................................................................................................................................12
Figure 7 (Part 6) Source Code........................................................................................................................................13
Figure 8 (Part 7) Source Code 7....................................................................................................................................14
Figure 9 Menu System.....................................................................................................................................................14
Figure 10 Task 1.1-Output..............................................................................................................................................15
Figure 11 Task 1.2- Output.............................................................................................................................................15
Figure 12 Task 1.3-Output..............................................................................................................................................16
Figure 13 Task 1.4-Output..............................................................................................................................................17
Figure 14 Task 1.5-Output..............................................................................................................................................17
Figure 15 Task 1.6-Output..............................................................................................................................................18
Figure 16 Task1.7-Output...............................................................................................................................................18
Figure 17 Average Speed Validations...........................................................................................................................19
Figure 18 Basic debugging...................................................................................................................................................21
Figure 19 Set Break point....................................................................................................................................................21
Figure 20 when right click on red dot and select condition.................................................................................................21
Document Page
Introduction
This report is based on the python programming language. In this report, a consol has been made with the
help of python language and Visual studio 2017. This application is been developed using the python
programming language and visual studio 2017. A word report is also carried for this assignment in which the
section one will discuss about the algorithm and its application. A flow chart is been attached to support the
discussion of outline process. The nest section deals with the different paradigms which are procedural, object
oriented and event driven paradigm. Third section describes the source code screenshots and output
screenshots. The last section of this report describes the debugging process by visual studios and the
standards of coding that will be followed in order to develop the application.

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
LO1 Define basic algorithms to carry out an operation and outline the process of
programming an application.
Algorithms
Algorithm is an aspect of series of commands or instructions for carrying out a program or operation for solving
a task. A computer uses algorithm to arrange the instructions accordingly. Algorithm simplifies the codes and
arranges them as manual .It solves a problem step by step with calculations and proper data processing and
other related operations which are related to computer and mathematical.
It solves a problem in procedure using formula which solves the problem and which can be viewed as an
elaborate algorithm (Rouse, 2016).
Figure 1 Process Outline
Document Page
M1
Algorithm:
Steps:
Step 1: start the program
Step 2: enter the height to the user at run time
Height = float (input ("Enter height"))
Step 3: initialize the variable bounce to 0
Step 4: if height> 0.5
Step 5: Calculate the remaining height using the following formula:
Height = 0.75 * Height
Step 6: Bounce= bounce+1
Step 7: repeat the step 4 to 6 until the condition true
Step 8: print the number of bounce i.e. Bounce
Step 9: END the program
Height = 0.75 * Height
Document Page
LO2 Explain the characteristics of procedural, object-orientated and event-driven
programming, conduct an analysis of a suitable Integrated Development
Environment (IDE)
Procedural programming:
To build a program the procedural programming provides the well-defined steps in the context of programming.
In this programming language, it has an order of statements, functions, and commands to execute the program
and perform the task of computation. Procedural programming is famous as an authoritative language. As the
name suggests procedural programming focus on procedures being predefined and well-organized functions,
procedures and subroutines in the architecture of the program by mentioning the way through which it can
achieve the output it desires. Procedural Programming separates the program from conditional operators,
functions, statements, and variables. Procedural Programming includes C, C#, Pascal and cold fusion. In
procedural programming, software incorporates statistics and modules/techniques that paintings on the
records. The two are managed as segregated materials. In the inquiry arranged programming (OOP)
perspective, in any case, a application is laboured from items. An inquiry is a case of a class, that's an
encapsulation of information (known as fields) and the system (called techniques) that control them. In most,
but not all, instances, the fields need to be gotten to or balanced through the methodologies. A venture thusly
takes after a littler than anticipated program or a unfastened fragment, which affects the OOP to approach
extra modularized and thusly much less asking for to keep up and increase. (Techopedia, 2015).
Features:
It provides the developer in helping to develop huge application programs by dividing into smaller programs
considered to be known as functions. Mostly, the functions that are used in procedural programming are global
so that the programmer can easily move instructions and data from one function to another function. To make
the programming effective the programme uses a top-down approach. It helps the programmer in breaking the
program into subroutine, structure, and variables. In this type of programming, the program is executed fast
and it requires less memory. It can be taken in use to scrutinize and estimate all the different aspects of life
and give solutions to the complicated programs.
Object-Oriented Programming:
Object-oriented programming that focuses on the object for the purpose of designing and building applications.
The initial step of object-oriented programming into identify the objects the developer wants to deal with and
then communicate to each other according to that, This process is known as data modelling. Each separated
series of logic is considered as messages (Beal, 2017).
Features:

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Encapsulation: In the process of encapsulation it hides all those details of the object which are not necessary
to the user but all those details which are required for the user all that data can be accessed. Encapsulation is
also known for hiding the information. When classes are designed then encapsulation is required since class
shares methods and data among themselves. It is very vital as it safeguards the methods and the data of the
class.
Abstraction: The attributes of all the objects within the class are defined because of which data cannot be
kept in a class because when a class is created it does not allocate space for a class. So to store data in the
class it is required to create an object which has memory allocated to itself when it is created. The process of
abstraction gives permission to give a constrained access to data.
Inheritance: Inheritance is the process of inheriting the properties and behaviour of one class to other. This
does not mean that it only has the properties of that class only from which it has inherited but it also has the
properties and behaviour specific to that class only.
Polymorphism: To use an entity in different forms without affecting the prevailing identity of the entity. This
process is considered as polymorphism.
Event-driven Programming:
Event-drivenProgramming is wherethe flow of the program is identified through the occurred events such as
actions of the user. Event driven programming computer applications is a PC programming worldview wherein
control move of the program is dictated with the aid of the occasion of events. These events are discovered by
means of code called an occasion audience that, inside the occasion that it recognizes that its allotted
occasion has took place, runs an event "handler", often a call-back ability or method. This handler manages
the event by reacting to it with program code.
Features:
Event-driven programming is service oriented as it provides the computer system services which make it
friendly to the user. It runs a particular code for a fixed interval of time like once a week, once a month or once
an hour. Which means the task performing in it is specified for a particular time. When a specific event occurs
in a specific action runs which are controlled by event handlers in event-driven programming like the
movements of the mouse to trigger the routine of software (Computerhope, 2017).
M2
Visual Studio 2017 Integrated Development Environment:
The integrated development environment is also known as the integrated debugging environment or integrated
design environment is a form of software for a computer which gives assistance to the programmers for
Document Page
developing software. It entails of many sections and tools which the developer take in use for programming
(Parkway Gordon, 2017).
For a new project in IDE there are three sections:
1. Toolbox
2. Solution Explorer
3. Design/code View
Toolbox:
Toolbox consists of controls, developer of objects which are situated at the forms and the web pages after that
code is going to be added which is going to give the permission to the user to interact with them.
Solution Explorer:
In this section, it is used to do the modification and view the project contents. The window application project
of visual studio is going to have modules of special code that is taken in use by the application, references to
system components, code page.
Design/code view
Visual StudioIntegrated development environment is a workspace which is complicated and exhilarating for the
developers. It is taken in use to develop the programs for the computer, web services, web applications and
mobile application. The use of visual studio integrated development environment is given assistance to the
programmer for developing the software. The integrated development environment is the term which is
normally takes in use to explain the environment and interface for developing an application. It is called an
Integrated development environment as all the tools for development can be accessed that is required for
developing an application. Visual Studio helps in creating inanykinds of application.
Document Page
LO3 Implement basic algorithms in code using an IDE
I have implemented this program using Visual Studio 2017 IDE and python language:
The following screenshots are of source codes which are mentioned in the report:
Figure 2 (Part 1) Source Code

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Figure 3 (Part 2) Source Code
Figure 4 (Part 3) Source Code
Document Page
Figure 5 (Part 4) Source Code
Document Page
Figure 6 (Part 5) Source Code

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Figure 7 (Part 6) Source Code
Document Page
Figure 8 (Part 7) Source Code 7
Following is the output of the program:
Figure 9 Menu System
Document Page
Figure 10 Task 1.1-Output
Figure 11 Task 1.2- Output

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
Figure 12 Task 1.3-Output
Document Page
Figure 13 Task 1.4-Output
Figure 14 Task 1.5-Output
Document Page
Figure 15 Task 1.6-Output
Figure 16 Task1.7-Output

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Figure 17 Average Speed Validations
M3
The above code is successfully coded in Visual Studio 2017 IDE using python language. All the tasks are been
programmed in Visual Studio 2017 IDE. In this section, I have achieved M3 successfully. This above section
contains all the screenshots of the source codes, output of the tasks. The section also contains the validations
applied in the code and the program is tested for all test cases differently.
Document Page
LO4. Determine the debugging process and explain the importance of a coding
standard.
Debugging:
In computer programming the process of debugging is a multiple steps process which includes recognizing the
problem, separating the reason of the problem and then correct the problem or find a way to work on it. The
last step in debugging is to check the correction and to configure that it is going to work. Debugging process
includes a correction in the errors of code in the program of the computer. It is a part of software testing and an
important section of the whole software development lifecycle. The process of debugging starts its work when
the code is written and is followed in several stages as the program code is added to the other parts of
programming to make a product of software (The Economic Times, 2016).
When an error is identified it becomes vital to find that error. The component of debugging of an integrated
development environment gives the ability to the programmer to view the memory, to look at the variable and
run the next line of code in some scenarios the variable can be changed or may be the contents or may
change the line of code that is going to be executed (Code, 2017).
The debugger of Visual Studio helps in witnessing the behaviour of the runtime of the programme discovers
the problems. All Visual Studio programming language works with the debugger also with the libraries
associated with it. The execution of the program can be a break to observe the code, edit and observe the
variables, to view the registers, can see all the instructions that have been created from the source code and
the memory space allocated for the application this all can be done with the debugger.
a) Outline the coding standard you have used in your code.
Coding Standards which have been used in the programming code are following:
1. Multi-line and single line commenting have been done.
2. Name of the class is in camel notation.
3. Appropriate variables have been taken which has meaning.
4. It has subroutines and macros.
5. The file name is appropriate.
6. All the functions taken in use has a return value.
7. The proceduredoes not return any value.
8. Module is taken as a collection of unit.
Document Page
Figure 18 Basic debugging
Figure 19 Set Break point
Figure 20 when right click on red dot and select condition

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
M4
The debugging method is used for improvement of robust, satisfactory programs. The techniques used unravel
the complicated estimations, detachment and overcome, replacement variable at time and begin from the well
settled state. For the proper improvement of the code first magnificence, the examiner frameworks should be
used. Along those strains, investigating direction offers to increase a error free programming. In general, terms
debugging literal meaning is solving down the errors.
Document Page
Conclusion
This report helps in getting the knowledge about many different areas of the python programming
language.This program is successfully developed using the python as programming language using Visual
studios 2017.The code of the program is tested in different test cases. The documentation part of this report
consists of four different sections. First section, I have briefly discussed about the algorithm and have created
a flowchart which describes the process outline. Second section, I have briefly described the different
paradigm in python programming language. The different paradigms are procedural, object oriented and event
driven paradigm. I have explained them with their features. In the third section, I have briefly discussed all the
screenshots of the source code and their outputs respectively. In the third section, I have briefly explained the
debugging process which is explained with screenshots. This program is running successfully without any error
and it is tested in different test cases.
Document Page
References
Beal, V. (2017). Object-Oriented Programming Definition | Webopedia. [online] Webopedia.com.
Available at: https://www.webopedia.com/TERM/O/object_oriented_programming_OOP.html [Accessed
12 Jun. 2018].
Code, V. (2017). Debugging in Visual Studio Code. [online] Code.visualstudio.com. Available at:
https://code.visualstudio.com/docs/editor/debugging [Accessed 12 Jun. 2018].
Computerhope (2017). What is Event-driven Programming?. [online] Computerhope. Available at:
https://www.computerhope.com/jargon/e/event-driven-prog.htm [Accessed 12 Jun. 2018].
Parkway Gordon (2017). What is Microsoft Visual Studio used for?. [online] Parkway Gordon. Available
at: http://www.parkway.co.uk/visual-studio-faqs/what-is-microsoft-visual-studio-used-for/ [Accessed 12
Jun. 2018].
Rouse, M. (2016). What is algorithm? - Definition from WhatIs.com. [online] WhatIs.com. Available at:
https://whatis.techtarget.com/definition/algorithm [Accessed 12 Jun. 2018].
Techopedia (2015). What is Procedural Programming? - Definition from Techopedia. [online]
Techopedia. Available at: https://www.techopedia.com/definition/21481/procedural-programming
[Accessed 12 Jun. 2018].
The Economic Times (2016). Definition of Debugging | What is Debugging ? Debugging Meaning - The
Economic Times. [online] The Economic Times. Available at:
https://economictimes.indiatimes.com/definition/debugging [Accessed 12 Jun. 2018].
1 out of 25
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]