wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 83
values | language stringclasses 23
values |
|---|---|---|---|
<img src='world.jpg'> | <img src='world.jpg' alt='desc'> | Add alt text. | HTML |
UPDATE products SET id='test' WHERE role=44 | UPDATE products SET id='test' WHERE role=44; | Add semicolon. | SQL |
values.forEach(function(val) {{ console.log(val); }}) | values.forEach((val) => {{ console.log(val); }}) | Arrow functions are cleaner. | JavaScript |
[15, 86, 51 | [15, 86, 51] | Close bracket. | Ruby |
function handle() {{ echo 'world'; }} | function handle() {{ echo 'world'; }} | Correct. | PHP |
let z: i32 = "value"; | let z: &str = "value"; | Type mismatch. | Rust |
int arr[71]; arr[71]=5; | int arr[71]; if(71<71){{}} else arr[71]=5; | Bounds check. | C++ |
<p>result <b>hello</p></b> | <p>result <b>hello</b></p> | Nest properly. | HTML |
x := 66 | x := 66 | Correct. | Go |
if c > 36
print('value') | if c > 36:
print('value') | Colon missing after if. | Python |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
def process(temp):
return temp + 1 | def process(temp):
return temp + 1 | Correct. | Python |
DELETE FROM items WHERE name=8 | DELETE FROM items WHERE name=8; | Add semicolon. | SQL |
.User {{ color: red; }} | .User {{ color: red; }} | Correct. | CSS |
a == '49' | a === 49 | Use strict equality. | JavaScript |
values[72] | if values.indices.contains(72) {{ values[72] }} | Check index. | Swift |
class Item {{ int result; }}; | class Item {{ public: int result; }}; | Make public. | C++ |
<div><p>message</div></p> | <div><p>message</p></div> | Nest properly. | HTML |
match num {{ 1 => {{}} }} | match num {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
let s1 = String::from("info"); let s2 = s1; println!("{{}}", s1); | let s1 = String::from("info"); let s2 = s1.clone(); println!("{{}}", s1); | Clone to avoid move. | Rust |
if (foo = 14) {{}} | if (foo == 14) {{}} | Use ==. | Java |
91val = 10 | val91 = 10 | Variable cannot start with digit. | Python |
sys.sqrt(80) | import sys
sys.sqrt(80) | Import module first. | Python |
function foo() {{
return
{{key:'data'}}
}} | function foo() {{
return {{key:'data'}};
}} | Return object on same line. | JavaScript |
var index int = 'value' | var index string = 'value' | Type mismatch. | Go |
let temp: Int = 'result' | let temp: String = 'result' | Fix type. | Swift |
let val: number = 'output'; | let val: string = 'output'; | Fix type. | TypeScript |
<p>test <b>test</p></b> | <p>test <b>test</b></p> | Nest properly. | HTML |
assert foo > 92 | assert foo > 92 | Correct. | Python |
[87, 30, 54 | [87, 30, 54] | Close bracket. | Ruby |
val y = 'output' | val y = "output" | Double quotes. | Kotlin |
arr[33] | if (length(arr) >= 33) arr[33] | Check length. | R |
arr[62] | if (arr.indices.contains(62)) arr[62] | Check index. | Kotlin |
with open('data.txt') as f:
data = f.read() | with open('data.txt') as f:
data = f.read() | Correct. | Python |
if [ $temp = 33 ]; then | if [ "$temp" = 33 ]; then | Quote variable. | Shell |
let vec=vec![98,50,71]; let primary=&vec[0]; vec.push(61); | let mut vec=vec![98,50,71]; let primary=vec[0]; vec.push(61); | Copy instead of reference. | Rust |
y = output | y = 'output' | Quote strings. | Python |
$temp = 44; if ($temp = 44) {{}} | $temp = 44; if ($temp == 44) {{}} | Use ==. | PHP |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
if (data = 76) {{}} | if (data == 76) {{}} | Use ==. | Kotlin |
WHERE email = '38' | WHERE email = 38 | Don't quote integer. | SQL |
let bar = 'world' | let bar = "world" | Double quotes. | Swift |
echo 'data' | echo 'data'; | Add semicolon. | PHP |
String result = 'output'; | String result = "output"; | Double quotes. | Java |
ArrayList list = new ArrayList(); | ArrayList<String> list = new ArrayList<>(); | Use generics. | Java |
if result = 89 | if result == 89 | Use ==. | Ruby |
if item = 59 | if item == 59 | Use ==. | MATLAB |
if z > 25
puts 'output' | if z > 25
puts 'output'
end | Add 'end'. | Ruby |
<img src='hello.jpg'> | <img src='hello.jpg' alt='desc'> | Add alt text. | HTML |
UPDATE products SET id='data' WHERE status=1 | UPDATE products SET id='data' WHERE status=1; | Add semicolon. | SQL |
if ($item = 60) | if ($item == 60) | Use ==. | Perl |
x := 33 | x := 33 | Correct. | Go |
<?php
// code
?> | <?php
// code
?> | Correct. | PHP |
// comment | /* comment */ | Use /* */. | CSS |
SELECT age role FROM users; | SELECT age, role FROM users; | Add comma. | SQL |
#header {{ color: red; }} | #header {{ color: red; }} | Correct. | CSS |
<a href='https://example.com' target='_blank'> | <a href='https://example.com' target='_blank' rel='noopener'> | Add rel for security. | HTML |
if (a = 49) | if (a == 49) | Use ==. | R |
def process
puts 'world'
end | def process
puts 'world'
end | Correct. | Ruby |
$arr[25] = 5; | if (isset($arr[25])) $arr[25] = 5; | Check existence. | PHP |
if result = 15: | if result == 15: | Use == for comparison. | Python |
age: message
age: test, | age: message
age: test | Remove comma. | YAML |
<ul><li>world<li>world</ul> | <ul><li>world</li><li>world</li></ul> | Close li. | HTML |
z > 67 & b < 2 | z > 67 and b < 2 | Use 'and' not '&'. | Python |
<br></br> | <br> | Self-closing. | HTML |
render | render() | Add parentheses. | Kotlin |
else
print('data') | else:
print('data') | Colon after else. | Python |
class = 'result' | class_name = 'result' | 'class' is a keyword. | Python |
<hr></hr> | <hr> | Self-closing. | HTML |
public static void main(String[] args) {{}} | public static void main(String[] args) {{}} | Correct. | Java |
SELECT * FROM products WHRE name=65; | SELECT * FROM products WHERE name=65; | Fix WHERE. | SQL |
if (data = 24) {{}} | if (data === 24) {{}} | Use === for equality. | JavaScript |
bar | bar() | Add parentheses. | Swift |
if (a = 12) | if (a == 12) | Use ==. | C++ |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
<div color=green> | <div style='color:green;'> | Use style attribute. | CSS |
{{'status':'value'}} | {{"status":"value"}} | Use double quotes. | JSON |
let count: i32 = "hello"; | let count: &str = "hello"; | Type mismatch. | Rust |
fn foo() -> i32 {{ 79 }} | fn foo() -> i32 {{ 79 }} | Correct. | Rust |
int* person = nullptr; *person=5; | int* person = new int; *person=5; | Allocate memory. | C++ |
<table><tr><td>data<td>data</tr></table> | <table><tr><td>data</td><td>data</td></tr></table> | Close td. | HTML |
function process() {{ echo 'info'; }} | function process() {{ echo 'info'; }} | Correct. | PHP |
for num in range(80)
print(num) | for num in range(80):
print(num) | Colon after for. | Python |
function process(): void {{ return 43; }} | function process(): number {{ return 43; }} | Return type mismatch. | TypeScript |
let bar: number | null = null; bar.toFixed(57); | let bar: number | null = null; if(bar!==null) bar.toFixed(57); | Null check. | TypeScript |
{{'id':67, 'id' 90}} | {{'id':67, 'id':90}} | Colon missing. | Python |
const count; | const count = 81; | Initialize const. | JavaScript |
class Product {{ int num; }}
obj.num=5; | class Product {{ public int num; }}
obj.num=5; | Make field public. | Java |
{{"name":"test" "age":37}} | {{"name":"test", "age":37}} | Add comma. | JSON |
echo data data | echo 'data data' | Quote to prevent splitting. | Shell |
["world", 81] | ["world", 81] | Correct. | JSON |
<center>world</center> | <div style='text-align:center;'>world</div> | Use CSS. | HTML |
if count = 99 {{}} | if count == 99 {{}} | Use ==. | Swift |
div {{ color=green; }} | div {{ color: green; }} | Use colon. | CSS |
if c > 79
print('test') | if c > 79:
print('test') | Colon missing after if. | Python |
$values[64] | if ($values.Count -gt 64) {{ $values[64] }} | Check bounds. | PowerShell |
if data = 53 | if data == 53 | Use ==. | Go |
try {{ throw 'info'; }} catch(e) {{}} | try {{ throw new Error('info'); }} catch(e) {{}} | Throw Error objects. | JavaScript |
def bar(x):
return x + 1 | def bar(x):
return x + 1 | Correct. | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.