- Explore and use various tools such as: GitHub, Visual Studio.
- Write a Python program using:
- modules
- packages
- functions using keyword arguments
- Run and test a Python program.
- Make a copy of this Github repository on your computer using
git clone https://github.com/MayurKolhe/Assignment_3.git
-
Write a Python package with sub-packages, modules, and functions using keyword arguments. Use the following directory outline and module names :
mathematics/ __init__.py whoami.py numbers/ __init__.py whoami.py series.py simple.py geometry/ __init__.py whoami.py rectangle.py circle.py cube.py
-
Create a
mathematics
package.- Initialize the
__all__
variable to thewhoami
module. - Create a
whoami
module.- Create a function named
getname
which returns the__name__
variable.
- Create a function named
- Create a
numbers
sub-package.- Initialize the
__all__
variable to thewhoami
andseries
modules. - Create a
whoami
module.- Create a function named
getname
which returns the__name__
variable.
- Create a function named
- Create a
series
module.- Create a function named
sum
which receives a keyword parameterlist
and returns the sum of all the values in the list. - Create a function named
average
which receives a keyword parameterlist
and returns the average of all the values in the list.
- Create a function named
- Create a
simple
module.- Create a function named
addition
which receives the keyword parametersleft
andright
and returns left plus right. - Create a function named
subtraction
which receives the keyword parametersleft
andright
and returns left minus right. - Create a function named
multiplication
which receives the keyword parametersleft
andright
and returns left multiplied by right. - Create a function named
division
which receives the keyword parametersleft
andright
and returns left divided by right.
- Create a function named
- Initialize the
- Create a
geometry
sub-package.- Initialize the
__all__
variable to thewhoami
,circle
, andcube
modules. - Create a
whoami
module.- Create a function named
getname
which returns the__name__
variable.
- Create a function named
- Create a
rectangle
module.- Create a function named
perimeter
which receives a keyword parameterslength
andwidth
and returns (2l + 2h). - Create a function named
area
which receives a keyword parameterslength
andwidth
and returns (l * h).
- Create a function named
- Create a
circle
module.- Create a function named
circumference
which receives the keyword parameterradius
and returns (2 * pi * r). - Create a function named
area
which receives the keyword parameterradius
and returns (pi * r * r).
- Create a function named
- Create a
cube
module.- Create a function named
surface_area
which receives the keyword parameterside
and returns (s * s * 6). - Create a function named
volume
which receives the keyword parameterside
and returns (s * s * s).
- Create a function named
- Initialize the
- Initialize the
-
Create your own main.py file to test all the modules and functions and run the program using the command below and repeat the steps above until you are satisfied your program output meets the above requirements. I will not grade this file - it is for your use to test the package.
python3 -m main
-
Run the unit testing program to ensure that your program runs as expected.
./test.sh
The unit testing will output the results of a series of tests using specific input and expected output. Any error will provide information on where the expected output is different from the actual output. You will need to edit your source code to fix the error and run
./test.sh
repeatedly until it passes all the test.
Periodically throughout the exercise, and when you have completed the exercise, submit the complete repository to Github.
git add .
git commit -m "your comment"
git push
In case it asks you to configure global variables for an email and name, just copy the commands it provides then replace the dummy text with your email and Github token.
git config --global user.email "[email protected]"
git config --global user.name "Tuffy Titan"
git commit -m "your comment"
git push
When you completed the final Github push, go back into github.com through the browser interface and ensure all your files have been correctly updated. Your files should be exactly as outlined using the directory structure in step 1.
- All points add up to a total of 100 points possible as detailed below. Partial credit will be given where applicable.
Points | Description |
---|---|
50 | initial git clone of this repository to your Tuffix machine |
1 | mathematics/init.py file submitted and meets the program requirements |
1 | mathematics/whoami.py file submitted and meets the program requirements |
1 | mathematics/numbers/init.py file submitted and meets the program requirements |
2 | mathematics/numbers/whoami.py file submitted and meets the program requirements |
2 | mathematics/numbers/series.py file submitted and meets the program requirements |
2 | mathematics/numbers/simple.py file submitted and meets the program requirements |
1 | mathematics/geometry/init.py file submitted and meets the program requirements |
2 | mathematics/geometry/whoami.py file submitted and meets the program requirements |
2 | mathematics/geometry/rectangle.py file submitted and meets the program requirements |
2 | mathematics/geometry/circle.py file submitted and meets the program requirements |
2 | mathematics/geometry/cube.py file submitted and meets the program requirements |
2 | unit test passes Test01_mathematics_whoami_getname |
2 | unit test passes Test02_mathematics_numbers_whoami_getname |
2 | unit test passes Test03_mathematics_numbers_series_sum |
2 | unit test passes Test04_mathematics_numbers_series_average |
2 | unit test passes Test05_mathematics_numbers_simple_addition |
2 | unit test passes Test06_mathematics_numbers_simple_subtraction |
2 | unit test passes Test07_mathematics_numbers_simple_multiplication |
2 | unit test passes Test08_mathematics_numbers_simple_division |
2 | unit test passes Test09_mathematics_geometry_whoami_getname |
2 | unit test passes Test10_mathematics_geometry_rectangle_perimeter |
2 | unit test passes Test11_mathematics_geometry_rectangle_area |
2 | unit test passes Test12_mathematics_geometry_cube_surfacearea |
2 | unit test passes Test13_mathematics_geometry_cube_volume |
2 | unit test passes Test14_mathematics_init |
2 | unit test passes Test15_mathematics_numbers_init |
2 | unit test passes Test16_mathematics_geometry_init |