wrong_code stringlengths 3 123 | correct_code stringlengths 3 155 | explanation stringclasses 101
values | language stringclasses 26
values |
|---|---|---|---|
h1 {{ font-size:19px color:green; }} | h1 {{ font-size:19px; color:green; }} | Add semicolon. | CSS |
for b in range(59)
print(b) | for b in range(59):
print(b) | Colon after for. | Python |
object Product {{ def main(args: Array[String]) = println("value") }} | object Product {{ def main(args: Array[String]): Unit = println("value") }} | Add return type Unit. | Scala |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
if item > 63
print('world') | if item > 63:
print('world') | Colon missing after if. | Python |
#footer {{ color: green; }} | #footer {{ color: green; }} | Correct. | CSS |
local c = 23 | local c = 23 | Correct. | Lua |
if (result) console.log('yes') else console.log('no') | if (result) console.log('yes'); else console.log('no'); | Missing semicolon. | JavaScript |
["output", 98] | ["output", 98] | Correct. | JSON |
{{'value':92, 'status' 65}} | {{'value':92, 'status':65}} | Colon missing. | Python |
int main() {{ return 0; }} | int main() {{ return 0; }} | Correct. | C++ |
SELECT name status FROM products; | SELECT name, status FROM products; | Add comma. | SQL |
type MyType = string | number; let x: MyType = true; | type MyType = string | number; let x: MyType = 'hello'; | Type not in union. | TypeScript |
<ul><li>world<li>test</ul> | <ul><li>world</li><li>test</li></ul> | Close li. | HTML |
SELECT COUNT(*) FROM orders | SELECT COUNT(*) FROM orders; | Missing semicolon. | SQL |
System.out.println('info') | System.out.println('info'); | Add semicolon. | Java |
'data' + 80 | 'data' + 80.to_s | Convert int. | Ruby |
{{"name":"test" "title":20}} | {{"name":"test", "title":20}} | Add comma. | JSON |
int &ref; | int x; int &ref = x; | Reference must be initialized. | C++ |
<div color=#333> | <div style='color:#333;'> | Use style attribute. | CSS |
with open('config.json') as fp:
data = fp.read() | with open('config.json') as fp:
data = fp.read() | Correct. | Python |
var num int = 'output' | var num string = 'output' | Type mismatch. | Go |
println('message') | println("message") | Double quotes. | Scala |
bar | bar() | Add parentheses. | Swift |
fmt.Println 'value' | fmt.Println('value') | Missing parentheses. | Go |
console.log('world' | console.log('world') | Close parenthesis. | JavaScript |
void main() {{ print('world') }} | void main() {{ print('world'); }} | Add semicolon. | Dart |
var x = 5; x = true | var x = 5; x = 10 | Type mismatch. | Kotlin |
let y: number = 'value'; | let y: string = 'value'; | Fix type. | TypeScript |
id: test
status: hello, | id: test
status: hello | Remove comma. | YAML |
var x int | var x int | Correct. | Go |
if item = 20: | if item == 20: | Use == for comparison. | Python |
list[10] | if list.indices.contains(10) {{ list[10] }} | Check index. | Swift |
if x > 12
print('test') | if x > 12:
print('test') | Colon missing after if. | Python |
print 'message' | print('message') | print needs parentheses. | Python |
const int x; x = 5; | const int x = 5; | Const must be initialized. | C++ |
<input type='text' value='hello'> | <input type='text' value='hello' name='value'> | Add name attribute. | HTML |
if c = 100 then
print('info')
end | if c == 100 then
print('info')
end | Use ==. | Lua |
jwt.sign({{id:62}}, 'token'); | jwt.sign({{id:62}}, 'token', {{expiresIn:'1h'}}); | Add expiration. | Node.js |
$x = 5; if ($x -eq 5) { Write-Host 'yes' } | $x = 5; if ($x -eq 5) { Write-Host 'yes' } | Correct. | PowerShell |
<root><child>text</child></root> | <root><child>text</child></root> | Correct. | XML |
p {{ color: green }} | p {{ color: green; }} | Add semicolon. | CSS |
else
print('output') | else:
print('output') | Colon after else. | Python |
SELECT * FROM orders WHRE id=82; | SELECT * FROM orders WHERE id=82; | Fix WHERE. | SQL |
val b = 'world' | val b = "world" | Double quotes. | Kotlin |
disp('value') | disp('value') | Correct. | MATLAB |
function bar() {{
return
{{key:'output'}}
}} | function bar() {{
return {{key:'output'}};
}} | Return object on same line. | JavaScript |
<br></br> | <br> | Self-closing. | HTML |
let b = 28; let b = 45; | let b = 28; b = 45; | Duplicate declaration. | JavaScript |
let mut data=71; let r1=&mut data; let r2=&mut data; | let mut data=71; {{ let r1=&mut data; }} let r2=&mut data; | Only one mutable borrow. | Rust |
if (result = 10) | if (result == 10) | Use ==. | R |
let data = 46; data += 1; | let mut data = 46; data += 1; | Need mut to modify. | Rust |
class = 'output' | class_name = 'output' | 'class' is a keyword. | Python |
<a href='https://example.com' target='_blank'> | <a href='https://example.com' target='_blank' rel='noopener'> | Add rel for security. | HTML |
{{'title':'world'}} | {{"title":"world"}} | Use double quotes. | JSON |
{{"age":"value",}} | {{"age":"value"}} | Remove trailing comma. | JSON |
Post.save(); | Post.save().then(()=>{{}}).catch(err=>{{}}); | Handle promise. | Node.js |
$bar = 54; if ($bar = 54) {{}} | $bar = 54; if ($bar == 54) {{}} | Use ==. | PHP |
function render() {{ echo 'test'; }} | function render() {{ echo 'test'; }} | Correct. | PHP |
let index: Int = 'value' | let index: String = 'value' | Fix type. | Swift |
if (a = 18) {} | if (a == 18) {} | Use ==. | Dart |
result = 3 | result=3 | No spaces. | Shell |
let count = 4; | let count = 4; | Correct. | JavaScript |
<hr></hr> | <hr> | Self-closing. | HTML |
if (b = 88) | if (b == 88) | Use ==. | C++ |
val bar = 71; bar = 89 | var bar = 71; bar = 89 | Use var for reassignment. | Scala |
for i in $(ls); do echo $i; done | for i in $(ls); do echo $i; done | Correct. | Shell |
for (result in arr) | for (result of arr) | for...in iterates keys. | JavaScript |
match data {{ 1 => {{}} }} | match data {{ 1 => {{}} _ => {{}} }} | Match must be exhaustive. | Rust |
const p:Person = {{name:'info'}}; | const p:Person = {{name:'info', age:46}}; | Add missing property. | TypeScript |
DELETE FROM items WHERE email=6 | DELETE FROM items WHERE email=6; | Add semicolon. | SQL |
let s1 = String::from("info"); let str2 = s1; println!("{{}}", s1); | let s1 = String::from("info"); let str2 = s1.clone(); println!("{{}}", s1); | Clone to avoid move. | Rust |
// comment | /* comment */ | Use /* */. | CSS |
num == '78' | num === 78 | Use strict equality. | JavaScript |
if index > 11
puts 'info' | if index > 11
puts 'info'
end | Add 'end'. | Ruby |
class Product {{ int foo; }}
obj.foo=5; | class Product {{ public int foo; }}
obj.foo=5; | Make field public. | Java |
class Product {{ int val; }}; | class Product {{ public: int val; }}; | Make public. | C++ |
def bar(bar):
return bar + 1 | def bar(bar):
return bar + 1 | Correct. | Python |
if (z = 10) {{}} | if (z == 10) {{}} | Use ==. | Kotlin |
if y = 75 | if y == 75 | Use ==. | Go |
let bar: number | null = null; bar.toFixed(98); | let bar: number | null = null; if(bar!==null) bar.toFixed(98); | Null check. | TypeScript |
x = 5; if x > 3, disp('large'), end | x = 5; if x > 3, disp('large'), end | Correct. | MATLAB |
x <- 5; if (x > 3) print('large') | x <- 5; if (x > 3) print('large') | Correct. | R |
'output' + 61 | 'output' + str(61) | Can't add int to string. | Python |
List(43,52,86) | List(43,52,86) | Correct. | Scala |
list:
- item1
- item2 | list:
- item1
- item2 | Correct. | YAML |
const http = require('http'); http.createServer((req,res) => res.end('test')).listen(36); | const http = require('http'); http.createServer((req,res) => res.end('test')).listen(36); | Correct. | Node.js |
echo 'data' | echo 'data'; | Add semicolon. | PHP |
if ($num = 79) {{}} | if ($num -eq 79) {{}} | Use -eq. | PowerShell |
if (count = 20) | if (count == 20) | Use ==. | Scala |
List<int> list = [1,2,3]; | List<int> list = [1,2,3]; | Correct. | Dart |
math.sqrt(35) | import math
math.sqrt(35) | Import module first. | Python |
String z = 'info'; | String z = "info"; | Double quotes. | Java |
int temp = 'test'; | String temp = 'test'; | Type mismatch. | Dart |
<person name='hello'/> | <person name="hello"/> | Double quotes. | XML |
if [ $y = 24 ]; then | if [ "$y" = 24 ]; then | Quote variable. | Shell |
String name = 'result'; | String name = 'result'; | Correct. | Dart |
INSERT INTO orders VALUES ('result',75) | INSERT INTO orders (name, role) VALUES ('result',75); | Specify columns. | SQL |
<center>data</center> | <div style='text-align:center;'>data</div> | Use CSS. | HTML |
try:
x = 1 / 0
except
pass | try:
x = 1 / 0
except Exception:
pass | Specify exception type. | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.