Esempio n. 1
0
def ui():
    cmd=main_menu()
    while cmd<> "exit":      
        if cmd=="operation":
            operations()
        elif cmd=="conversion":
            conversions()
        else:
            print "No such command"
        cmd=main_menu()
Esempio n. 2
0
def ui():
    cmd = main_menu()
    while cmd <> "exit":
        if cmd == "operation":
            operations()
        elif cmd == "conversion":
            conversions()
        else:
            print "No such command"
        cmd = main_menu()
Esempio n. 3
0
def conversions():
    """
    user interface for conversions
    """
    cmd=conv_menu()
    while cmd<>"back":
        if cmd=="subst":
            base=validate_base()
            dest=validate_dest()
            number=valid_op(base)
            try:
                rez=substitution(int(base),int(dest),number)
            except ValueError,msg:
                print msg
                conversions()
        elif cmd=="successiv":
            base=validate_base()
            dest=validate_dest()
            number=valid_op(base)
            try:
                rez=successiv(int(base),int(dest),number)
            except ValueError,msg:
                print msg
                conversions()
Esempio n. 4
0
def conversions():
    """
    user interface for conversions
    """
    cmd = conv_menu()
    while cmd <> "back":
        if cmd == "subst":
            base = validate_base()
            dest = validate_dest()
            number = valid_op(base)
            try:
                rez = substitution(int(base), int(dest), number)
            except ValueError, msg:
                print msg
                conversions()
        elif cmd == "successiv":
            base = validate_base()
            dest = validate_dest()
            number = valid_op(base)
            try:
                rez = successiv(int(base), int(dest), number)
            except ValueError, msg:
                print msg
                conversions()
Esempio n. 5
0
     number=valid_op(base)
     try:
         rez=successiv(int(base),int(dest),number)
     except ValueError,msg:
         print msg
         conversions()
 elif cmd=="inter":
     base=validate_base()
     dest=validate_dest()
     inter=validate_inter()
     number=valid_op(base)
     try:
         rez=intermediate(int(base),int(inter),int(dest),number)
     except ValueError,msg:
         print msg
         conversions()
 elif cmd=="rapid":
     base=valid_rapid()
     dest=validate_dest()
     number=valid_op(base)
     try:
         rez=rapid(int(base),int(dest),number)
     except ValueError,msg:
         print msg
         conversions()
 elif cmd=="back":
     ui()
 else:
     print "No such command"
     conversions()
 print result(convert_from(rez))
Esempio n. 6
0
     number = valid_op(base)
     try:
         rez = successiv(int(base), int(dest), number)
     except ValueError, msg:
         print msg
         conversions()
 elif cmd == "inter":
     base = validate_base()
     dest = validate_dest()
     inter = validate_inter()
     number = valid_op(base)
     try:
         rez = intermediate(int(base), int(inter), int(dest), number)
     except ValueError, msg:
         print msg
         conversions()
 elif cmd == "rapid":
     base = valid_rapid()
     dest = validate_dest()
     number = valid_op(base)
     try:
         rez = rapid(int(base), int(dest), number)
     except ValueError, msg:
         print msg
         conversions()
 elif cmd == "back":
     ui()
 else:
     print "No such command"
     conversions()
 print result(convert_from(rez))