Skip to content
TheChatArchiveThe Chat Archive
Kimikimi-k2-0711-preview· Moonshot AIHugging Face LMArena Human Preference 140K

now add a seperate banking functionality to it, users can deposit, withdraw and check…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Mistralmistral-small-2506’s answer.
  1. User

    now add a seperate banking functionality to it, users can deposit, withdraw and check their balance

  2. Kimi Assistant
    # Simple Calculator + Mini-Bank
    import os, json
    
    DATA_FILE = "bank.json"
    
    def load_balance():
        return json.load(open(DATA_FILE)) if os.path.exists(DATA_FILE) else 0.0
    
    def save_balance(b):
        json.dump(b, open(DATA_FILE, "w"))
    
    def calculator():
        print("Simple Calculator\nOperations: +  -  *  /\nType 'quit' to exit")
        while True:
            expr = input("calc> ").strip()
            if expr.lower() == "quit":
                break
            try:
                a, op, b = expr.split()
                a, b = float(a), float(b)
                res = {"+": a+b, "-": a-b, "*": a*b, "/": a/b if b else None}[op]
                print("Result:", res if res is not None else "Div by 0")
            except Exception:
                print("Invalid input (use: num op num)")
    
    def bank():
        bal = load_balance()
        print("Mini-Bank\nCommands: deposit <amt>, withdraw <amt>, balance, back")
        while True:
            cmd = input("bank> ").strip().lower()
            if cmd == "back":
                break
            elif cmd == "balance":
                print(f"Balance: ${bal:.2f}")
            elif cmd.startswith("deposit "):
                try:
                    amt = float(cmd.split()[1])
                    if amt <= 0: raise ValueError
                    bal += amt
                    save_balance(bal)
                    print("Deposited.")
                except ValueError:
                    print("Enter positive number.")
            elif cmd.startswith("withdraw "):
                try:
                    amt = float(cmd.split()[1])
                    if amt <= 0 or amt > bal: raise ValueError
                    bal -= amt
                    save_balance(bal)
                    print("Withdrawn.")
                except ValueError:
                    print("Invalid amount.")
            else:
                print("Unknown command.")
    
    def main():
        while True:
            mode = input("Mode (calc/bank/quit)> ").strip().lower()
            if mode == "calc":
                calculator()
            elif mode == "bank":
                bank()
            elif mode == "quit":
                break
            else:
                print("Choose calc, bank, or quit.")
    
    if __name__ == "__main__":
        main()
    

    Usage

    1. Run the script.
    2. Choose calc for the calculator or bank for banking.
    3. In bank mode: • deposit 100 – adds 100•‘withdraw50‘–subtracts100 • `withdraw 50` – subtracts 50
      • balance – shows current balance
      • back – return to mode selection
    4. Type quit at the mode prompt to exit.

    Balance is persisted in bank.json in the same directory.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.