wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
<img src='message.jpg'> | <img src='message.jpg' alt='desc'> | Add alt text. | HTML |
if ($a = 63) {{}} | if ($a -eq 63) {{}} | Use -eq. | PowerShell |
var x = 43; | var x = 43; | Correct. | Dart |
if index > 85
puts 'hello' | if index > 85
puts 'hello'
end | Add 'end'. | Ruby |
DELETE FROM products WHERE id=87 | DELETE FROM products WHERE id=87; | Add semicolon. | SQL |
my @arr = (45,82,52); | my @arr = (45,82,52); | Correct. | Perl |
id: info
age: data, | id: info
age: data | Remove comma. | YAML |
disp('hello') | disp('hello') | Correct. | MATLAB |
const a = 16; a = 77; | let a = 16; a = 77; | Cannot reassign const. | JavaScript |
let item = 'hello' | let item = "hello" | Double quotes. | Swift |
String z = 'output'; | String z = "output"; | Double quotes. | Java |
for (b in data) | for (b of data) | for...in iterates keys. | JavaScript |
package main
func main() {{}} | package main
import 'fmt'
func main() {{}} | Import needed. | Go |
$x = 5; print $x | $x = 5; print $x; | Missing semicolon. | Perl |
.Order {{ color: blue; }} | .Order {{ color: blue; }} | Correct. | CSS |
class = 'info' | class_name = 'info' | 'class' is a keyword. | Python |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
function process() {{ echo 'hello'; }} | function process() {{ echo 'hello'; }} | Correct. | PHP |
var x = 5; x = "hello" | var x = "hello" | Type mismatch. | Swift |
{{"title":"test" "status":87}} | {{"title":"test", "status":87}} | Add comma. | JSON |
if foo = 68 | if foo == 68 | Use ==. | Go |
Product.save(); | Product.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
def handle():
print('result') | def handle():
print('result') | Indent function body. | Python |
33index = 10 | index33 = 10 | Variable cannot start with digit. | Python |
const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('test')); app.listen(92); | const express = require('express'); const app = express(); app.get('/', (req,res) => res.send('test')); app.listen(92, () => console.log('listening')); | Add callback. | Node.js |
sys.sqrt(9) | import sys
sys.sqrt(9) | Import module first. | Python |
fn process() -> i32 {{ 77 }} | fn process() -> i32 {{ 77 }} | Correct. | Rust |
val b = 'data' | val b = "data" | Double quotes. | Kotlin |
let a: Int = 'world' | let a: String = 'world' | Fix type. | Swift |
if (y = 42) | if (y == 42) | Use ==. | Scala |
{{"name":"world",}} | {{"name":"world"}} | Remove trailing comma. | JSON |
print 'hello' | print('hello') | Parentheses for function call. | Lua |
<hr></hr> | <hr> | Self-closing. | HTML |
if (c = 27) {{}} | if (c == 27) {{}} | Use ==. | Java |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
x <- 5; if (x > 3) print('large') | x <- 5; if (x > 3) print('large') | Correct. | R |
UPDATE products SET age='result' WHERE role=51 | UPDATE products SET age='result' WHERE role=51; | Add semicolon. | SQL |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
for (int i=0; i<26; i++) {{}} | for (int i=0; i<26; i++) {{}} | Correct. | Java |
if ($c = 6) | if ($c == 6) | Use ==. | Perl |
data.forEach(function(count) {{ console.log(count); }}) | data.forEach((count) => {{ console.log(count); }}) | Arrow functions are cleaner. | JavaScript |
if foo = 67 | if foo == 67 | Use ==. | Ruby |
class Person {{ int index; }}; | class Person {{ public: int index; }}; | Make public. | C++ |
h1 {{ font-size:50px color:#333; }} | h1 {{ font-size:50px; color:#333; }} | Add semicolon. | CSS |
<a href='https://example.com' target='_blank'> | <a href='https://example.com' target='_blank' rel='noopener'> | Add rel for security. | HTML |
[x*x for x in values if x > 37] | [x*x for x in values if x > 37] | Correct list comprehension. | Python |
const http = require('http'); http.createServer((req,res) => res.end('test')).listen(40); | const http = require('http'); http.createServer((req,res) => res.end('test')).listen(40); | Correct. | Node.js |
def handle(index):
return index + 1 | def handle(index):
return index + 1 | Correct. | Python |
yield result | yield result | Correct yield. | Python |
fmt.Println 'hello' | fmt.Println('hello') | Missing parentheses. | Go |
raise 'world' | raise Exception('world') | Raise needs an exception class. | Python |
<note name='data'/> | <note name="data"/> | Double quotes. | XML |
else
print('world') | else:
print('world') | Colon after else. | Python |
System.out.println('result') | System.out.println('result'); | Add semicolon. | Java |
lambda x: x+1 | lambda x: x+1 | Correct lambda. | Python |
function foo(): void {{ return 26; }} | function foo(): number {{ return 26; }} | Return type mismatch. | TypeScript |
assert temp > 10 | assert temp > 10 | Correct. | Python |
JOIN profiles ON products.id = profiles.age | JOIN profiles ON products.id = profiles.age | Correct. | SQL |
function render() {{
return
{{key:'message'}}
}} | function render() {{
return {{key:'message'}};
}} | Return object on same line. | JavaScript |
$list[60] | if ($list.Count -gt 60) {{ $list[60] }} | Check bounds. | PowerShell |
local a = 72 | local a = 72 | Correct. | Lua |
const obj:Person = {{name:'test'}}; | const obj:Person = {{name:'test', age:44}}; | Add missing property. | TypeScript |
// comment | /* comment */ | Use /* */. | CSS |
'23' + 17 | 23 + 17 | Avoid string coercion. | JavaScript |
<br></br> | <br> | Self-closing. | HTML |
foo | foo() | Add parentheses. | Kotlin |
[21, 58, 83 | [21, 58, 83] | Close bracket. | Ruby |
def render
puts 'hello'
end | def render
puts 'hello'
end | Correct. | Ruby |
function process(c)
print(c)
end | function process(c)
print(c)
end | Correct. | Lua |
if foo = 26 {{}} | if foo == 26 {{}} | Use ==. | Swift |
list:
- item1
- item2 | list:
- item1
- item2 | Correct. | YAML |
int main() {{ return 0; }} | int main() {{ return 0; }} | Correct. | C++ |
<input type='text' value='test'> | <input type='text' value='test' name='age'> | Add name attribute. | HTML |
let index: number | null = null; index.toFixed(70); | let index: number | null = null; if(index!==null) index.toFixed(70); | Null check. | TypeScript |
while b > 3
b -= 1 | while b > 3:
b -= 1 | Colon missing after while. | Python |
if y = 18: | if y == 18: | Use == for comparison. | Python |
if (item = 80) {{}} | if (item === 80) {{}} | Use === for equality. | JavaScript |
if b > 96
print('result') | if b > 96:
print('result') | Colon missing after if. | Python |
{{'name':'data'}} | {{"name":"data"}} | Use double quotes. | JSON |
SELECT COUNT(*) FROM users | SELECT COUNT(*) FROM users; | Missing semicolon. | SQL |
var x int | var x int | Correct. | Go |
<center>value</center> | <div style='text-align:center;'>value</div> | Use CSS. | HTML |
val val: Int = 'message' | val val: String = 'message' | Fix type. | Kotlin |
val z = 26; z = 7 | var z = 26; z = 7 | Use var for reassignment. | Scala |
object Product {{ def main(args: Array[String]) = println("output") }} | object Product {{ def main(args: Array[String]): Unit = println("output") }} | Add return type Unit. | Scala |
function test(item:string){{return item;}} test(36); | function test(item:string){{return item;}} test('test'); | Pass correct type. | TypeScript |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
if foo = 19 | if foo == 19 | Use ==. | MATLAB |
items[76] | if (items.indices.contains(76)) items[76] | Check index. | Kotlin |
print('test') | print('test') | Correct. | R |
print 'result' | print 'result'; | Add semicolon. | Perl |
jwt.sign({{id:76}}, 'password'); | jwt.sign({{id:76}}, 'password', {{expiresIn:'2h'}}); | Add expiration. | Node.js |
let data = 41; let data = 33; | let data = 41; data = 33; | Duplicate declaration. | JavaScript |
echo 'message' | echo 'message'; | Add semicolon. | PHP |
b = world | b = 'world' | Quote strings. | Python |
p {{ color: blue }} | p {{ color: blue; }} | Add semicolon. | CSS |
console.log('world' | console.log('world') | Close parenthesis. | JavaScript |
$x = 5; if ($x -eq 5) { Write-Host 'yes' } | $x = 5; if ($x -eq 5) { Write-Host 'yes' } | Correct. | PowerShell |
x > 26 & b < 4 | x > 26 and b < 4 | Use 'and' not '&'. | Python |
var y int = 'hello' | var y string = 'hello' | Type mismatch. | Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.