This commit is contained in:
沈瑗杰 2020-12-22 06:12:38 +08:00
parent 7acfbf7a17
commit f62dccea4f
2 changed files with 21 additions and 5 deletions

View File

@ -27,13 +27,23 @@ def P_C_M(A, B): # stand for Physics Calculation multiple
Unit2 = []
for unit in B[3]:
if unit in [Unit1]:
n = Unit1.index(unit)
Unit1.pop(n)
Unit1.remove(unit)
else:
Unit2.append(unit)
if Unit1 == None:
Unit1 = []
print(Unit1, Unit2)
for unit in Unit2:
print(unit)
if unit in Unit1:
Unit1.remove(unit)
Unit2.remove(unit)
print(unit)
else:
pass
print(Unit1, Unit2)
C = [Float, Int, Unit1, Unit2]
print(C)
return C
@ -57,11 +67,16 @@ def P_C_D(A, B): # stand for Physics Calculation divide
Unit2 = []
for unit in B[2]:
if unit in [Unit1]:
n = Unit1.index(unit)
Unit1.pop(n)
Unit1.remove(unit)
else:
Unit2.append(unit)
if Unit1 == None:
Unit1 = []
for unit in Unit2:
if unit in Unit1:
Unit1.remove(unit)
Unit2.remove(unit)
else:
pass
C = [Float, Int, Unit1, Unit2]
return C

View File

@ -14,6 +14,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)