def modelA(): G_data = Gen_Data() s0 = G_data.Generate_Decimal(1.00, 20.00, 1) s1 = G_data.Generate_Decimal(1.00, 10.00, 2) op = G_data.opMul re = operator.mul(s0, s1) result = "%.1f %s %.2f = " % (s0, op, s1) result_ = float(re) return result, result_
def modelB(): G_data = Gen_Data() s0 = G_data.Generate_Decimal(1.00, 20.00, 1) s1 = G_data.Generate_Decimal(1.00, 10.00, 1) op = G_data.opDiv re = operator.mul(s0, s1) result = "%.3f %s %.1f = " % (re, op, s0) result_ = float(s1) return result, result_
def modelSub(): G_data = Gen_Data() s0 = G_data.Generate_Int(50, 99) s1 = G_data.Generate_Decimal(1.001, 30.001, 3) op = G_data.opSub re = operator.sub(s0, s1) result = "%d %s %.3f = " % (s0, op, s1) result_ = float(re) return result, result_
def modelD(): G_data = Gen_Data() s0 = G_data.Generate_Decimal(1.001, 10.001, 3) s1 = G_data.Generate_Int(1, 20) op = G_data.opDiv re = operator.mul(s0, s1) result = "%.3f %s %d = " % (re, op, s1) result_ = float(s0) return result, result_
def modelPlus(): G_data = Gen_Data() s0 = G_data.Generate_Decimal(1.01, 50.00, 2) s1 = G_data.Generate_Decimal(1.001, 30.001, 3) op = G_data.opAdd re = operator.add(s0, s1) result = "%.2f %s %.3f = " % (s0, op, s1) result_ = float(re) return result, result_
def modelC(): G_data = Gen_Data() s0 = G_data.Generate_Int(1, 99) s1 = G_data.Generate_Int(1, 20) op = G_data.opDiv re = operator.truediv(operator.mul(s0, s1), 10000) s0 = operator.truediv(s0, 100) result = "%.4f %s %.2f = " % (re, op, s0) result_ = float(operator.truediv(s1, 100)) return result, result_
def modelE(): G_data = Gen_Data() s0 = G_data.Generate_Int(2, 20) x = "X" op = G_data.opSub s1 = G_data.Generate_Int(2, 20) s2 = operator.mul(s0, s1) s3 = G_data.Generate_Int(2, s1) result_ = operator.add(s1, s3) result = "%d(%s %s %d) = %d" % (s0, x, op, s3, s2) return result, result_
def modelD(): G_data = Gen_Data() s0 = G_data.Generate_Decimal(200.00, 500.00, 2) x = "X" op = G_data.opSub s1 = G_data.Generate_Decimal(2.00, 10.00, 2) s2 = G_data.Generate_Int(1, 9) s3 = operator.mul(s1, s2) s3 = operator.sub(s0, s3) result = "%.2f %s %d %s = %.2f" % (s0, op, s2, x, s3) return result, float(s1)
def modelB(): G_data = Gen_Data() s0 = G_data.Generate_Decimal(1.00, 20.00, 2) x = "X" op = G_data.opAdd s1 = G_data.Generate_Decimal(3.00, 50.00, 2) s2 = G_data.Generate_Int(2, 10) s3 = operator.mul(s0, s2) s3 = operator.add(s3, s1) result = "%.2f %s %d %s = %.2f" % (s1, op, s2, x, s3) return result, float(s0)
def modelG(): G_data = Gen_Data() s0 = G_data.Generate_Int(2, 30) s1 = G_data.Generate_Int(2, 30) s2 = operator.mul(s0, s1) x = "X" op1 = G_data.opAdd op2 = G_data.opDiv s3 = G_data.Generate_Int(2, s1) result_ = operator.sub(s1, s3) result = "%d %s ( %s %s %d ) = %d" % (s2, op2, x, op1, s3, s0) return result, result_
def modelF(): G_data = Gen_Data() s0 = G_data.Generate_Int(2, 20) s1 = G_data.Generate_Int(2, 20) s2 = operator.mul(s0, s1) x = "X" op1 = G_data.opSub op2 = G_data.opDiv s3 = G_data.Generate_Int(s2, 1000) result_ = operator.sub(s3, s2) result = "( %d %s %s ) %s %d = %d" % (s3, op1, x, op2, s1, s0) return result, result_
def modelC(): G_data = Gen_Data() flag = True s0 = G_data.Generate_Decimal(10.00, 20.00, 2) x = "X" op = G_data.opSub s1 = G_data.Generate_Int(2, 20) s2 = G_data.Generate_Decimal(1.00, 20.00, 2) s3 = operator.mul(s1, s0) s3 = operator.sub(s3, s2) result = "%d %s %s %.2f = %.2f" % (s1, x, op, s2, s3) return result, float(s0)
def modelJ(): G_data = Gen_Data() s0 = G_data.Generate_Int(2, 9) s1 = G_data.Generate_Int(2, 19) s2 = G_data.Generate_Int(2, 9) s3 = operator.mul(operator.mul(s0, s1), s2) x = "X" op1 = G_data.opDiv op2 = G_data.opMul result_ = s0 result = "%d %s %d %s = %d" % (s3, op1, s1, x, s0) return result, result_
def modelI(): G_data = Gen_Data() s0 = G_data.Generate_Int(2, 30) s1 = G_data.Generate_Int(50, 100) s2 = G_data.Generate_Int(2, s1) s3 = operator.sub(s1, s2) x = "X" op1 = G_data.opDiv op2 = G_data.opSub result_ = operator.mul(s0, s1) result = "%s %s %d %s %d = %d" % (x, op1, s0, op2, s2, s3) return result, result_
print 'thread %s is running...' % threading.current_thread().name n = 0 while n < 5: n = n + 1 print 'thread %s >>> %s' % (threading.current_thread().name, n) time.sleep(1) print 'thread %s ended.' % threading.current_thread().name print 'thread %s is running...' % threading.current_thread().name t = threading.Thread(target=loop, name='LoopThread') t.start() t.join() print 'thread %s ended.' % threading.current_thread().name G_data = Gen_Data() s0 = G_data.Generate_Decimal(1.00, 20.00, 2) s1 = G_data.Generate_Int(2, 10) s2 = G_data.Generate_Int(2, 20) s3 = operator.mul(s0, s1) s3 = operator.add(s3, s2) x = "X" op = "+" result = "%d %s %s %d = %s" % (s1, x, op, s2, s_temp) s_temp = "%.2f" % (s_temp) print(result) print(s0) pic_original = 'D:\\pic\\pic\\' pic_ready = 'D:\\pic\\ready\\' pic_set = []