From b41a9456a0de3fcd35073e7a0650fed97938e2b5 Mon Sep 17 00:00:00 2001 From: arukan02 Date: Tue, 11 Feb 2025 16:38:40 +0900 Subject: [PATCH 1/2] done fork --- README.md | 1 + calc_mul.py | 34 ------------------------------ test_cases.py | 58 ++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 51 insertions(+), 42 deletions(-) delete mode 100755 calc_mul.py diff --git a/README.md b/README.md index c307636..12533b0 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # SDM-report2 +これは豊橋技術科学大学のソフトウェア設計論の第2レポートのために作られたレポジトリである。 \ No newline at end of file diff --git a/calc_mul.py b/calc_mul.py deleted file mode 100755 index b55a367..0000000 --- a/calc_mul.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/python3 - -import re - -def calc(A,B): - ai=str(A) - bi=str(B) - p = re.compile('\d+(\.\d+)?') - if p.match(ai) or p.match(bi): - a=float(ai) - b=float(bi) - if 0 Date: Tue, 11 Feb 2025 16:40:57 +0900 Subject: [PATCH 2/2] done report2 --- calc_mul.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 calc_mul.py diff --git a/calc_mul.py b/calc_mul.py new file mode 100644 index 0000000..d94cc11 --- /dev/null +++ b/calc_mul.py @@ -0,0 +1,35 @@ +#!/usr/bin/python3 + +import re + +def calc(A, B): + # Check if A and B are integers + if not isinstance(A, int) or not isinstance(B, int): + return -1 + + # Check valid range (1 <= A, B <= 999) + if 1 <= A <= 999 and 1 <= B <= 999: + return A * B + else: + return -1 + +def main(): + while True: + try: + A = input('input A: ') + B = input('input B: ') + + if A.lower() == 'end' or B.lower() == 'end': + break + + # Convert input to integer + A = int(A) + B = int(B) + + print('input A * input B =', calc(A, B)) + + except ValueError: + print("Invalid input. Please enter integers between 1 and 999.") + +if __name__ == '__main__': + main()