From 234f98df640a6b182c426f4e8a36d8af39fc0bcd Mon Sep 17 00:00:00 2001 From: DolmaMan Date: Sat, 21 Mar 2026 14:02:04 +0800 Subject: [PATCH 1/2] L-03: Added rectangle.py --- .idea/.gitignore | 3 +++ .idea/geometric_lib.iml | 8 ++++++++ .idea/inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/misc.xml | 7 +++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ rectangle.py | 5 +++++ 7 files changed, 43 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/geometric_lib.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 rectangle.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000..26d33521af --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/geometric_lib.iml b/.idea/geometric_lib.iml new file mode 100644 index 0000000000..d8b3f6cbf0 --- /dev/null +++ b/.idea/geometric_lib.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000000..105ce2da2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000..1d3ce46ba0 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000..5c0675083d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000..35eb1ddfbb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/rectangle.py b/rectangle.py new file mode 100644 index 0000000000..771a133ffb --- /dev/null +++ b/rectangle.py @@ -0,0 +1,5 @@ +def area(a, b): + return a * b + +def perimeter(a, b): + return a + b \ No newline at end of file From 9912c568beecc93f7f7c4f8d8bec3108bc704d51 Mon Sep 17 00:00:00 2001 From: DolmaMan Date: Sat, 21 Mar 2026 14:03:18 +0800 Subject: [PATCH 2/2] L-03: Added triangle.py and fixed rectangle perimeter bug --- rectangle.py | 2 +- triangle.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 triangle.py diff --git a/rectangle.py b/rectangle.py index 771a133ffb..2edbbf5cf3 100644 --- a/rectangle.py +++ b/rectangle.py @@ -2,4 +2,4 @@ def area(a, b): return a * b def perimeter(a, b): - return a + b \ No newline at end of file + return 2* (a + b) \ No newline at end of file diff --git a/triangle.py b/triangle.py new file mode 100644 index 0000000000..2e1c3fdcdb --- /dev/null +++ b/triangle.py @@ -0,0 +1,5 @@ +def area(a, h): + return a * h / 2 + +def perimeter(a, b, c): + return a + b + c \ No newline at end of file