diff --git a/cleanCodeTest01.ipynb b/cleanCodeTest01.ipynb new file mode 100644 index 0000000..e1c8a46 --- /dev/null +++ b/cleanCodeTest01.ipynb @@ -0,0 +1,81 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "12ce8957", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "900\n", + "End Point X-Axis (Top Right): 140\n", + "End Point Y-Axis (Bottom Left): 110\n" + ] + } + ], + "source": [ + "class Coordinate:\n", + " def __init__(self, x, y):\n", + " self.x = x\n", + " self.y = y\n", + "\n", + "\n", + "class Rectangle:\n", + " def __init__(self, origin, width, height):\n", + " self.origin = origin\n", + " self.width = width\n", + " self.height = height\n", + "\n", + " def calculate_area(self):\n", + " return self.width * self.height\n", + "\n", + " def end_point_top_right_x(self):\n", + " return self.origin.x + self.width\n", + "\n", + " def end_point_bottom_left_y(self):\n", + " return self.origin.y + self.height\n", + "\n", + " def print_end_points(self):\n", + " print(\"End Point X-Axis (Top Right): \" + str(self.end_point_top_right_x()))\n", + " print(\"End Point Y-Axis (Bottom Left): \" + str(self.end_point_bottom_left_y()))\n", + "\n", + "\n", + "def create_rectangle():\n", + " main_position = Coordinate(50, 100)\n", + " rectangle_position = Rectangle(main_position, 90, 10)\n", + "\n", + " return rectangle_position\n", + "\n", + "\n", + "rectangle = create_rectangle()\n", + "\n", + "print(rectangle.calculate_area())\n", + "rectangle.print_end_points()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.14.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}