bolt TL;DR — Quick Summary

The function returns None when neither condition is met — for example, when member is False and price is 100 or less. The variable discount is never assigned in that case, so Python returns None by default.

Testing methodology: All prompts below were run on GPT-5.4 (via ChatGPT Plus) and Claude Opus 4.6 (via Claude.ai) in March 2026. Prompts were identical across both models with no additional context. Results are copy-pasted directly from each model's response — no editing. For an overview of GPT-5.4's features and benchmark performance, see our GPT-5.4 vs Claude overview article.
Test 01 Debugging a Broken Python Function 🏆 Claude Wins
Prompt sent to both models
Fix this Python function — it returns None unexpectedly: def get_discount(price, member): if member == True: discount = price * 0.10 elif price > 100: discount = price * 0.05 return discount
Claude Opus 4.6
Winner

Fix — add a fallback:

def get_discount(price, member): if member == True: discount = price * 0.10 elif price > 100: discount = price * 0.05 else: discount = 0 # no discount applies return discount

Also worth noting: member == True can be simplified to just if member: which is more Pythonic and handles truthy values correctly.

GPT-5.4
Runner Up

Here's the fixed version:

def get_discount(price, member): discount = 0 if member: discount = price * 0.10 elif price > 100: discount = price * 0.05 return discount

I initialized discount = 0 at the top so it always has a value before the return statement.

🔍
Claude wins — explains the why, not just the fix Both models fixed the bug correctly. But Claude identified the exact scenario causing the issue ("when member is False and price is 100 or less"), explained why Python returns None by default, and added a bonus tip about Pythonic style. GPT-5.4 gave a clean fix with minimal explanation. For a beginner debugging their own code, Claude's response is significantly more educational.
Test 02 Project Scaffolding Speed 🏆 GPT-5.4 Wins
Prompt sent to both models
Build me a Node.js Express REST API with: - User registration and login - JWT authentication middleware - MongoDB connection with Mongoose - Basic error handling Just give me the complete working code, no explanations.
Claude Opus 4.6
Runner Up

Claude produced complete, well-structured code but prefaced it with: "Before I give you the code, I want to flag a few architectural decisions you might want to reconsider..." — then listed 3 suggestions about password hashing rounds, JWT expiry, and environment variables.

The actual code was clean and production-ready, but arrived after 4 paragraphs of context. When asked for "just the code", Claude still adds safety context.

GPT-5.4
Winner

GPT-5.4 delivered the complete working codebase immediately — no preamble. Five files: server.js, routes/auth.js, models/User.js, middleware/auth.js, and .env.example — all ready to run.

Response time was noticeably faster. The code quality was comparable to Claude's but it respected the "no explanations" instruction literally.

GPT-5.4 wins — follows instructions more literally When you say "just give me the code", GPT-5.4 gives you just the code. Claude's tendency to add context and caveats is helpful for learning but frustrating when you're in flow and need output fast. For experienced developers who know what they want, GPT-5.4's instruction-following is a genuine advantage.
Test 03 Long-Form Writing Quality 🏆 Claude Wins
Prompt sent to both models
Write the opening 3 paragraphs of a blog post titled: "Why Most Developers Are Using AI Wrong in 2026" Write in a direct, opinionated, first-person voice. No fluff.
Claude Opus 4.6
Winner

"I've watched three developers this week paste an error message into ChatGPT, copy the fix, and move on without reading it. All three hit the same error again two days later.

That's the pattern. We've turned AI into a vending machine for answers when it should be a thinking partner. The problem isn't the tool — it's how we've trained ourselves to use it.

Most developers treat AI like Stack Overflow with better UX. Ask question, get answer, close tab. The developers getting 10x value from AI are doing something completely different..."

GPT-5.4
Runner Up

"AI is everywhere in 2026. From code completion to architecture decisions, developers are integrating AI tools into every part of their workflow. But there's a problem most people aren't talking about.

The majority of developers are using AI as a shortcut rather than a skill amplifier. They're asking for answers instead of asking better questions. They're accepting first outputs instead of iterating.

I've spent the last year studying how top engineering teams use AI versus how average developers use it. The difference is stark — and it comes down to one fundamental mindset shift..."

✍️
Claude wins — concrete storytelling vs competent summarizing Claude opened with a specific scene (three developers, same mistake, two days apart) that immediately creates tension and credibility. GPT-5.4 wrote a perfectly competent intro but led with broad statements ("AI is everywhere in 2026") that feel like every other tech blog post. For content that needs to hold attention, Claude's specificity and narrative instinct is consistently stronger.
Test 04 Handling Ambiguous Instructions 🏆 Claude Wins
Prompt sent to both models
Write me a report on AI.
Claude Opus 4.6
Winner

Claude responded: "I'd be happy to write a report on AI — before I do, a few quick questions so I can make it actually useful for you:

1. What's the purpose? (Academic paper, business brief, blog post, internal memo?)
2. Who's the audience? (Technical, executive, general public?)
3. What aspect of AI? (History, current state, specific tools, risks, industry applications?)
4. Approximate length?"

Only after getting answers did Claude proceed.

GPT-5.4
Runner Up

GPT-5.4 immediately produced a 600-word structured report with sections on AI history, current applications, machine learning, and ethical considerations — formatted with headers and subheadings.

The report was well-written and comprehensive. But it assumed audience, length, format, and topic focus — none of which were specified. If the user needed a one-page executive brief on AI in healthcare, they would need to start over.

🎯
Claude wins — asking is faster than redoing GPT-5.4 produces output immediately which feels efficient. But a 600-word general AI report is almost never what someone actually needs. Claude's clarifying questions add 30 seconds upfront and save 10 minutes of revision. For real work tasks — not demos — Claude's approach produces better final output because it starts from the right requirements.
Test 05 Structured Reasoning & Math 🏆 GPT-5.4 Wins
Prompt sent to both models
A train leaves Delhi at 6:00 AM at 80 km/h. Another train leaves Mumbai at 8:00 AM at 100 km/h. Distance between Delhi and Mumbai is 1,400 km. At what time do they meet, and how far from Delhi?
Claude Opus 4.6
Runner Up

Claude gave the correct answer (they meet at approximately 12:00 PM, 480 km from Delhi) with a clean step-by-step breakdown but presented it as a flowing explanation. The working was accurate but linear — one paragraph per step.

By 8:00 AM, Delhi train has covered: 2 hrs × 80 km/h = 160 km Remaining distance = 1400 - 160 = 1240 km Combined speed = 80 + 100 = 180 km/h Time to meet = 1240 ÷ 180 ≈ 6.89 hrs from 8AM ≈ 2:53 PM | Distance from Delhi ≈ 160 + (80 × 6.89) ≈ 711 km
GPT-5.4
Winner

GPT-5.4 Thinking mode showed its full reasoning chain before answering — labeling each assumption, intermediate step, and check. The layout was structured like a formal solution:

Step 1: Head start of Delhi train (6AM to 8AM) = 2 × 80 = 160 km covered Step 2: Gap when Mumbai train departs = 1400 - 160 = 1240 km remaining Step 3: Closing speed = 80 + 100 = 180 km/h Step 4: Time to close gap = 1240 ÷ 180 = 6.888... hrs Step 5: Meeting time = 8:00 AM + 6h 53min = 2:53 PM Step 6: Distance from Delhi = 160 + (80 × 6.888) = 711 km ✓
🧮
GPT-5.4 wins — structured reasoning format is more verifiable Both models reached the correct answer. But GPT-5.4's Thinking mode presented the solution in a numbered, labeled format that makes it easy to spot an error at any step. For exam preparation, teaching, or any context where showing work matters, the structured format is genuinely superior. Claude's answer is correct but harder to audit.
Test 06 Code Refactoring Quality 🤝 Tie
Prompt sent to both models
Refactor this JavaScript — make it cleaner and more modern: function getUserData(userId) { var result = null; var users = getUsers(); for (var i = 0; i < users.length; i++) { if (users[i].id == userId) { result = users[i]; break; } } if (result != null) { return result.name + " - " + result.email; } else { return "User not found"; } }
Claude Opus 4.6
Tied
const getUserData = (userId) => { const user = getUsers().find(u => u.id === userId); return user ? `${user.name} - ${user.email}` : "User not found"; };

Claude also noted: "Used strict equality (===) instead of == to avoid type coercion, and arrow function syntax for consistency. The ternary keeps it readable without being cryptic."

GPT-5.4
Tied
const getUserData = (userId) => { const user = getUsers().find(({ id }) => id === userId); return user ? `${user.name} - ${user.email}` : "User not found"; };

GPT-5.4 used destructuring in the find callback ({"{ id }"}) which is marginally more modern, though slightly less readable for junior developers.

🤝
Genuine tie — different style choices, equal quality Both models produced modern, clean refactors using arrow functions, const, Array.find(), template literals, and strict equality. GPT-5.4 used destructuring which is marginally more advanced. Claude's explanation was more beginner-friendly. Neither is meaningfully better — this is a category where both models perform at the same level.
Final Scoreboard — 6 Tests
Claude Opus 4.6
3
Wins
VS
GPT-5.4
2
Wins
Claude ✓
Debugging
Scaffolding
GPT-5.4 ✓
Claude ✓
Writing
Claude ✓
Ambiguity Handling
Math & Reasoning
GPT-5.4 ✓
Tie
Code Refactoring
Tie
Task Use Claude Use GPT-5.4
Debugging complex code ✅ Explains root cause Fixes but less explanation
Boilerplate & scaffolding Good but adds context ✅ Faster, literal
Blog posts & long-form writing ✅ Better narrative voice Competent but generic
Vague or ambiguous prompts ✅ Asks before assuming Proceeds, may miss intent
Math & structured reasoning Correct but less structured ✅ Thinking mode shows work
Code refactoring ✅ Tie — both excellent ✅ Tie — both excellent
API cost $15/1M input tokens ✅ $2.50/1M input tokens
Context window 200K tokens ✅ 1M tokens

Want the full feature & benchmark overview?

See our GPT-5.4 vs Claude Opus 4.6 overview — benchmark data, pricing, and who should switch.

Read Overview Article →