CS1101-04 Assignment
PART 1:
According to Gunashree (2024), incremental development is the building of a software piece
by piece. The steps involved consist of requirement analysis, planning, design,
implementation, testing and deployment.
1) The first step in the software development process is problem identification or
requirement analysis. The client needs a function that calculates the length of the
hypotenuse in a right-angled triangle, given the lengths of the other two legs. This is
based on the Pythagorean Theorem:
c = √(a² + b²)
2) In the design phase, we outline the logic of the hypotenuse function. The function will
take two inputs (a and b), square each, add the results, and return the square root using
[Link](). This follows the Pythagorean Theorem. The design ensures the function is
simple, readable, and easy to test. I have broken down the design into the following
steps:
Step 1: Create a function with two parameters and a placeholder return.
Step 2: Square both legs and return their sum.
Step 3: Return the square root of the sum using [Link]() (Python Software
Foundation, 2024).
3) Screenshot of the code implementation:
4) Testing:
The code has been tested with the provided, as well as other cases to ensure that it
gives the desired output. This has been implemented in the given screenshot:
5) Deployment:
This function will be integrated into the client’s pre-existing educational platform and
then the development of this product will be complete.
PART 2:
For my custom portfolio, I have decided to build a word frequency calculator. This
function takes in a string, most likely a sentence and returns the frequency of each
individual word. The development process given below:
1) Step 1:
The problem is to compute how many times each word appears in a given string. The
function should:
Accept a string of text as input.
Split the string into individual words.
Count the occurrences of each word.
Return a dictionary of word–frequency pairs (Python Software Foundation, 2024).
2) Step 2:
The function’s design was broken down into clear, testable increments:
Step 1: Define the function with a text parameter and a placeholder return.
Step 2: Use .split() to break the string into words and print them (to verify).
Step 3: Create a dictionary to count word occurrences.
Step 4: Iterate through the word list and update the dictionary with word counts.
Step 5: Return the final dictionary with frequencies.
This modular approach ensures each component works before moving to the next, as
recommended in incremental development (Gunashree, 2024).
3) Step 3: The code implementation:
4) Step 4: Testing and output
5) Step 5: Deployment: Now this function will be added to my portfolio on GitHub or
the website where I host my portfolio, and that will complete the development of this
function.
References:
Python Software Foundation. (2024). Built-in types — Mapping types — dict. Python 3.12
documentation. [Link]
Gunashree, R. S. (2024, July 31). Definition of incremental development: Benefits and
challenges. Devzery. [Link]
Python Software Foundation. (2024). math — Mathematical functions. Python 3.12.
[Link]