DEV Community

Cover image for Python3 Programming - Exercise 5 b - Design Solution
Otu Michael
Otu Michael

Posted on • Updated on

Python3 Programming - Exercise 5 b - Design Solution

Design a solution

continuation of exercise 5 a (Analysis of a solution)

In this phase, we try to put together the information we gathered from the analysis we made. Here we may provide a human-readable solution that would be used to implement the solution. Again, we decide what data types and data structures that would be used. So here, we could let the average score be an integer or a float and keep all the test scores in an array ( here a list). What should come in mind is pseudo code ( a.k.a false code). From the analysis we can say:

Solution design with false code

label: type we used is what we discussed in Exercise 2 ( Datatypes) - Type hinting


  • Most of these stages are done together because this is a small problem - which we could even implement straight forward
  • Remember, it is easier to implement a solution after we have analyzed and chose which approach of the solution gave us the desired outcome, efficiently. This means, there could be more than one solution to solve the problem.


Tip: look out for the given inputs ( the available parameters), the desired outputs ( what is expected), and the process ( how to get the output).

Analyze and design a solution for the following problems.

  1. Given that a quadratic equation is of the form, Ax^2 + Bx + C = 0 , where A , B , C are real parameters such that A , B is not zero. A and B are the coefficients of x, of second and first degrees respectively and c a constant. Find and output the roots of the quadratic equation.

  2. Find the Area of a circle of radius, r, given that PI is 3.143.

  3. A shop keeper sold an item of cost, $340.00 at $372.99 including a tax of $2.99 .find the

    • selling price
    • profit made
    • profit percentage
    • tax percentage


  • To analyze the problem, look out for the input, output and the process
  • In the design stage, we choose what data type a value should be or be returned and a data structure, suitable to hold these values
  • We choose a solution that best gives the desired outcome
  • The best design is simple and readable

Discussion (0)