コード例 #1
0
def ShowEquation():
    funcList = ESI.ReadEqua()
    tmpIndexFuncShow = 1
    for func in funcList:
        print str(tmpIndexFuncShow) + ")" + " " + str(func)
        tmpIndexFuncShow += 1
コード例 #2
0
ESI.WriteLog("====================RUNTIME LOG====================")
while True:
    cmd = raw_input()

    #添加方程
    if cmd == "addEqua":
        addedFunc = raw_input("Enter your equation here:")
        if ESC.CheckEquation_equa(addedFunc) == 0:
            ESI.WriteLog("Try to add equation: " + addedFunc)
            ESI.WriteLog(ESW.Warn("missEquater"))
        elif ESC.CheckEquation_equa(addedFunc) > 1:
            ESI.WriteLog("Try to add equation: " + addedFunc)
            ESI.WriteLog(ESW.Warn("excessiveEquater"))
        else:
            if ESFC.PurifyEquation(addedFunc) in ESI.ReadEqua():
                print ESI.WriteLog(
                    "You are adding a function that exist in the function list"
                )
            else:
                #在写入堆栈的时候将等式去空格,初步格式化
                addedFunc = ESFC.PurifyEquation(addedFunc)
                ESI.WriteEqua(addedFunc)
                print ESI.WriteLog("Add equation: " + addedFunc)
                if len(ESC.UndefAutoCheck(addedFunc)) > 0:
                    print "Auto check unknown numbers found" + str(
                        ESC.UndefAutoCheck(addedFunc))
                    print "Do you want to add these unknowns?(y/n)"
                    confirm = raw_input()
                    if confirm == "y":
                        for unknown in ESC.UndefAutoCheck(addedFunc):