From d573f98ddd43ef536abbbb80ff33ccf715599cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E7=91=97=E6=9D=B0?= <3695888@qq.com> Date: Tue, 22 Dec 2020 06:36:02 +0800 Subject: [PATCH] DEBUG! --- libs/P_C.py | 13 ++++++------- test.py | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/P_C.py b/libs/P_C.py index e1dbdd2..fd99cf6 100644 --- a/libs/P_C.py +++ b/libs/P_C.py @@ -23,10 +23,9 @@ def P_C_M(A, B): # stand for Physics Calculation multiple Int -= 1 else: pass - Unit1 = [].append(A[2].extend(B[2])) - Unit2 = [] + Unit1, Unit2 = A[2] + B[2], [] for unit in B[3]: - if unit in [Unit1]: + if unit in Unit1: Unit1.remove(unit) else: Unit2.append(unit) @@ -47,6 +46,7 @@ def P_C_D(A, B): # stand for Physics Calculation divide formats: A & B list format:docs.basic_config.json:basic_number """ + B[2], B[3] = B[3], B[2] C = [0.0, 1, [], []] Float = float(A[0] / B[0]) Int = int(A[1] - B[1]) @@ -58,10 +58,9 @@ def P_C_D(A, B): # stand for Physics Calculation divide Int -= 1 else: pass - Unit1 = A[2].extend(B[3]) - Unit2 = [] - for unit in B[2]: - if unit in [Unit1]: + Unit1, Unit2 = A[2] + B[2], [] + for unit in B[3]: + if unit in Unit1: Unit1.remove(unit) else: Unit2.append(unit) diff --git a/test.py b/test.py index 7a44472..01d9ff6 100644 --- a/test.py +++ b/test.py @@ -15,6 +15,7 @@ print("B = " , B) C = libs.P_C.P_C_M(A, B) D = libs.P_C.P_C_D(A, B) E = libs.P_C.P_C_D(C, B) + print("A × B = " , C) print("A ÷ B = " , D) print("A × B ÷ B = " , E) \ No newline at end of file