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 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 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 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 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 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 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_
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 = []