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.
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
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.
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.
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 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 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.
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.
"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..."
"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..."
Write me a report on AI.
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 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.
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 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 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 ✓
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";
}
}
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."
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.
| 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.