Use cases / Debug and fix code instantly

Debug and fix code instantly

Paste broken code and get fixes with clear explanations. Torki identifies bugs, suggests optimizations, and rewrites with improvements — supporting Python, JavaScript, SQL, and more.

Try in Torki
Category
Developers
Feature
Chat
Model
Cosmos
Share
Copy link
1

Paste your code

Drop in the function, query, or file that isn't working. Include any error messages you're seeing. Torki works with Python, JavaScript, TypeScript, SQL, PHP, Go, Rust, and most popular languages.

This Python function should calculate compound interest but it's giving wrong results: def compound_interest(principal, rate, years) amount = principal * (1 + rate) ** years interest = amount - principl return interest

2

Get fixes with explanations

Torki identifies every bug, explains why it's wrong, and provides the corrected code. It doesn't just fix — it teaches you what went wrong so you can avoid similar mistakes.

3

Ask for optimizations

Beyond fixing bugs, ask Torki to optimize for performance, add error handling, write tests, or refactor for readability. It understands the broader context of your code.

Torki Chat
This function should calculate compound interest but gives wrong results:
def compound_interest(principal, rate, years)
    amount = principal * (1 + rate) ** years
    interest = amount - principl
    return interest
Torki
I found 3 bugs in your function: 1. Missing colon on the function definition line — Python requires : after the parameter list. 2. Typo: principl → should be principal (missing 'a'). 3. Rate should be divided by 100 if passed as a percentage (e.g., 5 for 5%). Fixed code:
def compound_interest(principal, rate, years):
    """Calculate compound interest.
    rate: annual rate as percentage (e.g., 5 for 5%)
    """
    decimal_rate = rate / 100
    amount = principal * (1 + decimal_rate) ** years
    interest = amount - principal
    return round(interest, 2)
Test it:
>>> compound_interest(1000, 5, 10)
628.89  # $1000 at 5% for 10 years
Ask anything...

Ready to try for yourself?

Paste your broken code. Torki finds the bugs, explains them, and gives you the fix.

Try in Torki