def colPrompt(varname, ncol):
    """Prompt for a column index."""
    while True:
        ans = int(input(f"Insert index of {varname} column [0-{ncol-1}]: "))
        if (ans < 0) or (ans >= ncol):
            print("Value not good.")
        else:
            return ans