code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
d = {}
d["__proto__"]="testing"
print d
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
355,
0,
0,
0,
0,
0,
6,
0
],
[
14,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
0,
1,
0,
0,
0,
0,
3,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,... | [
"d = {}",
"d[\"__proto__\"]=\"testing\"",
"print(d)"
] |
# Test the creation of sets
l = [1,2,3,4,1,1]
print l
s = set(l)
print s
print len(s)
| [
[
14,
0,
0.3333,
0.1667,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.5,
0.1667,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.6667,
0.1667,
0,
0.66,
... | [
"l = [1,2,3,4,1,1]",
"print(l)",
"s = set(l)",
"print(s)",
"print(len(s))"
] |
x="OK";print x
| [] | [] |
print str(range(-8,-4,-1))[:5]
print len(range(-8,-4,-1))
| [
[
8,
0,
0.5,
0.5,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print(str(range(-8,-4,-1))[:5])",
"print(len(range(-8,-4,-1)))"
] |
def f(*a):
print a
def g(x, *a):
print x, a
def h(x, y, *a):
print x, y, a
def i(x, y=4, *a):
print x, y, a
f()
f(1)
f(1, 2, 3)
g(1)
g(1, 2, 3)
h(1, 2)
h(1, 2, 3)
h(1, 2, 3, 4)
i(1)
i(1, 2, 3)
i(1, 2, 3, 4)
| [
[
2,
0,
0.0652,
0.087,
0,
0.66,
0,
899,
0,
1,
0,
0,
0,
0,
1
],
[
8,
1,
0.087,
0.0435,
1,
0.62,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
2,
0,
0.1957,
0.087,
0,
0.66,
0.... | [
"def f(*a):\n print(a)",
" print(a)",
"def g(x, *a):\n print(x, a)",
" print(x, a)",
"def h(x, y, *a):\n print(x, y, a)",
" print(x, y, a)",
"def i(x, y=4, *a):\n print(x, y, a)",
" print(x, y, a)",
"f()",
"f(1)",
"f(1, 2, 3)",
"g(1)",
"g(1, 2, 3)",
"h(1, 2)",
"h(... |
print (2 < 3 < 9)
print (2 < (3 < 9))
| [
[
8,
0,
0.5,
0.5,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print (2 < 3 < 9)",
"print (2 < (3 < 9))"
] |
def f():
yield 1
yield 2
g = f()
print g.next()
print g.next()
for i in f():
print i
| [
[
2,
0,
0.25,
0.375,
0,
0.66,
0,
899,
0,
0,
0,
0,
0,
0,
0
],
[
8,
1,
0.25,
0.125,
1,
0.52,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
[
8,
1,
0.375,
0.125,
1,
0.52,
1,
0,... | [
"def f():\n yield 1\n yield 2",
" yield 1",
" yield 2",
"g = f()",
"print(g.next())",
"print(g.next())",
"for i in f():\n print(i)",
" print(i)"
] |
print "234".replace("\r\n", "\n")
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(\"234\".replace(\"\\r\\n\", \"\\n\"))"
] |
class A: pass
a = A()
print isinstance([], list)
print isinstance([], dict)
print isinstance([], str)
print isinstance([], tuple)
print isinstance([], A)
print "---"
print isinstance({}, list)
print isinstance({}, dict)
print isinstance({}, str)
print isinstance({}, tuple)
print isinstance({}, A)
print "---"
print i... | [
[
3,
0,
0.027,
0.027,
0,
0.66,
0,
429,
0,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0541,
0.027,
0,
0.66,
0.0323,
475,
3,
0,
0,
0,
429,
10,
1
],
[
8,
0,
0.1081,
0.027,
0,
0.66... | [
"class A: pass",
"a = A()",
"print(isinstance([], list))",
"print(isinstance([], dict))",
"print(isinstance([], str))",
"print(isinstance([], tuple))",
"print(isinstance([], A))",
"print(\"---\")",
"print(isinstance({}, list))",
"print(isinstance({}, dict))",
"print(isinstance({}, str))",
"pri... |
def f():
print "in f"
return 10
def g():
print "in g"
return 20
retval = True
def h():
global retval
retval = not retval
return retval
for i in range(3):
print f() if h() else g()
| [
[
2,
0,
0.1176,
0.1765,
0,
0.66,
0,
899,
0,
0,
1,
0,
0,
0,
1
],
[
8,
1,
0.1176,
0.0588,
1,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
13,
1,
0.1765,
0.0588,
1,
0.66,
... | [
"def f():\n print(\"in f\")\n return 10",
" print(\"in f\")",
" return 10",
"def g():\n print(\"in g\")\n return 20",
" print(\"in g\")",
" return 20",
"retval = True",
"def h():\n global retval\n retval = not retval\n return retval",
" retval = not retval",
" ... |
import pkga.pkgb.modc
import pkga.pkgb.modc # only one print
print "a name", pkga.__name__
print "a.b name", pkga.pkgb.__name__
print "a.b.c name", pkga.pkgb.modc.__name__
print "stuff", pkga.pkgb.modc.stuff
print "things", pkga.pkgb.modc.things
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
812,
0,
1,
0,
0,
812,
0,
0
],
[
1,
0,
0.25,
0.125,
0,
0.66,
0.1667,
812,
0,
1,
0,
0,
812,
0,
0
],
[
8,
0,
0.5,
0.125,
0,
0.66,
... | [
"import pkga.pkgb.modc",
"import pkga.pkgb.modc # only one print",
"print(\"a name\", pkga.__name__)",
"print(\"a.b name\", pkga.pkgb.__name__)",
"print(\"a.b.c name\", pkga.pkgb.modc.__name__)",
"print(\"stuff\", pkga.pkgb.modc.stuff)",
"print(\"things\", pkga.pkgb.modc.things)"
] |
x = [v*v for v in range(0,5)]
print x[3]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
5,
0,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = [v*v for v in range(0,5)]",
"print(x[3])"
] |
print 5&7
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(5&7)"
] |
from pkga.pkgb.modc import stuff as mystuff
from pkga.pkgb.modc import things as mythings
print mystuff, mythings
| [
[
1,
0,
0.25,
0.25,
0,
0.66,
0,
812,
0,
1,
0,
0,
812,
0,
0
],
[
1,
0,
0.5,
0.25,
0,
0.66,
0.5,
812,
0,
1,
0,
0,
812,
0,
0
],
[
8,
0,
1,
0.25,
0,
0.66,
1,
53... | [
"from pkga.pkgb.modc import stuff as mystuff",
"from pkga.pkgb.modc import things as mythings",
"print(mystuff, mythings)"
] |
print [1,2,"OK",4][-3:3][1]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
6,
0,
0,
0,
0,
0,
0
]
] | [
"print [1,2,\"OK\",4][-3:3][1]"
] |
class A: pass
class B: pass
class C: pass
class D(A): pass
class E(A,B): pass
class F(E,C): pass
a,b,c,d,e,f = A(),B(),C(),D(),E(),F()
print isinstance(a, A)
print isinstance(a, B)
print isinstance(a, C)
print isinstance(a, D)
print isinstance(a, E)
print isinstance(a, F)
print "---"
print isinstance(b, A)
print isin... | [
[
3,
0,
0.0196,
0.0196,
0,
0.66,
0,
429,
0,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.0392,
0.0196,
0,
0.66,
0.0208,
197,
0,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.0588,
0.0196,
0,
0.66... | [
"class A: pass",
"class B: pass",
"class C: pass",
"class D(A): pass",
"class E(A,B): pass",
"class F(E,C): pass",
"a,b,c,d,e,f = A(),B(),C(),D(),E(),F()",
"print(isinstance(a, A))",
"print(isinstance(a, B))",
"print(isinstance(a, C))",
"print(isinstance(a, D))",
"print(isinstance(a, E))",
"... |
print 2*3**2
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2*3**2)"
] |
s = set([2,3,4])
t = set([3,4,5])
u = set([1,3,5])
a = s.intersection(t)
b = u.intersection(s)
c = u.intersection(t)
print a
print b
print c
print a == set([3, 4])
print b == set([3])
print c == set([3, 5])
d = s.intersection(t, u)
print d
print d == set([3])
| [
[
14,
0,
0.05,
0.05,
0,
0.66,
0,
553,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.1,
0.05,
0,
0.66,
0.0714,
15,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.15,
0.05,
0,
0.66,
0... | [
"s = set([2,3,4])",
"t = set([3,4,5])",
"u = set([1,3,5])",
"a = s.intersection(t)",
"b = u.intersection(s)",
"c = u.intersection(t)",
"print(a)",
"print(b)",
"print(c)",
"print(a == set([3, 4]))",
"print(b == set([3]))",
"print(c == set([3, 5]))",
"d = s.intersection(t, u)",
"print(d)",
... |
print 2 in {1:2}
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2 in {1:2})"
] |
# Test that a clone of a list really is distinct
l = [1,2,3]
print l
m = list(l)
print m
m.pop()
print l
print m
| [
[
14,
0,
0.25,
0.125,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.375,
0.125,
0,
0.66,
0.1667,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.5,
0.125,
0,
0.66,
0... | [
"l = [1,2,3]",
"print(l)",
"m = list(l)",
"print(m)",
"m.pop()",
"print(l)",
"print(m)"
] |
if "a" is "a":
print "OK"
| [
[
4,
0,
0.75,
1,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.5,
1,
0.02,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"if \"a\" is \"a\":\n print(\"OK\")",
" print(\"OK\")"
] |
print type(4)
print type(444444444444444444444)
print type(4.5)
| [
[
8,
0,
0.3333,
0.3333,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,... | [
"print(type(4))",
"print(type(444444444444444444444))",
"print(type(4.5))"
] |
x = {}
x['y'] = "test"
print x['y']
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
6,
0
],
[
14,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
0,
1,
0,
0,
0,
0,
3,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,... | [
"x = {}",
"x['y'] = \"test\"",
"print(x['y'])"
] |
print len("\\0")
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(len(\"\\\\0\"))"
] |
class Wee:
def __init__(self):
self.called = False
def __iter__(self):
return self
def next(self):
print "in next"
if not self.called:
self.called = True
return "dog"
raise StopIteration
for i in Wee():
print i
| [
[
3,
0,
0.4286,
0.7857,
0,
0.66,
0,
410,
0,
3,
0,
0,
0,
0,
1
],
[
2,
1,
0.1786,
0.1429,
1,
0.84,
0,
555,
0,
1,
0,
0,
0,
0,
0
],
[
14,
2,
0.2143,
0.0714,
2,
0.39,
... | [
"class Wee:\n def __init__(self):\n self.called = False\n def __iter__(self):\n return self\n def next(self):\n print(\"in next\")\n if not self.called:",
" def __init__(self):\n self.called = False",
" self.called = False",
" def __iter__(self):\n ... |
def f(iter):
for v in iter:
print v
f(x*y for x in range(10) for y in range(x))
| [
[
2,
0,
0.5,
0.75,
0,
0.66,
0,
899,
0,
1,
0,
0,
0,
0,
1
],
[
6,
1,
0.625,
0.5,
1,
0.86,
0,
553,
2,
0,
0,
0,
0,
0,
1
],
[
8,
2,
0.75,
0.25,
2,
0.7,
0,
535,
... | [
"def f(iter):\n for v in iter:\n print(v)",
" for v in iter:\n print(v)",
" print(v)",
"f(x*y for x in range(10) for y in range(x))"
] |
print "hello world"
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(\"hello world\")"
] |
import sys
sys.x = 4
sys.y = ["stuff"]
sys.z = {'things': sys.x}
print sys.x, sys.y, sys.z
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.4,
0.2,
0,
0.66,
0.25,
671,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.6,
0.2,
0,
0.66,
0.5,
3... | [
"import sys",
"sys.x = 4",
"sys.y = [\"stuff\"]",
"sys.z = {'things': sys.x}",
"print(sys.x, sys.y, sys.z)"
] |
print("X-OK-Y".split("-")[1])
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(\"X-OK-Y\".split(\"-\")[1])"
] |
n = 0
for x in range(0,10,2):
n += 1
print n
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
773,
1,
0,
0,
0,
0,
1,
0
],
[
6,
0,
0.625,
0.5,
0,
0.66,
0.5,
190,
3,
0,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.25,
0,
0.66,
1,
535,... | [
"n = 0",
"for x in range(0,10,2):\n n += 1",
"print(n)"
] |
print len({'a':1, 'b':2})
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(len({'a':1, 'b':2}))"
] |
def f(a,b,c=10,d=20,*e,**f):
sortf = [(x,y) for x,y in f.items()]
sortf.sort()
print a,b,c,d,e,sortf
f(1,2)
f(1,2,3)
f(1,2,3,5)
f(1,2,d=3,c=5)
f(1,2,e=['x','y','z'])
f(1,2,d=3,c=5,e=['x','y','z'])
f(1,2,3,5,['x','y','z'])
f(1,2,3,5,['x','y','z'],z=5,y=9)
f(1,2,3,5,['x','y','z'],'blorp','wee',z=5,y=9)
| [
[
2,
0,
0.1786,
0.2857,
0,
0.66,
0,
899,
0,
6,
0,
0,
0,
0,
3
],
[
14,
1,
0.1429,
0.0714,
1,
0.4,
0,
623,
5,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.2143,
0.0714,
1,
0.4,
... | [
"def f(a,b,c=10,d=20,*e,**f):\n sortf = [(x,y) for x,y in f.items()]\n sortf.sort()\n print(a,b,c,d,e,sortf)",
" sortf = [(x,y) for x,y in f.items()]",
" sortf.sort()",
" print(a,b,c,d,e,sortf)",
"f(1,2)",
"f(1,2,3)",
"f(1,2,3,5)",
"f(1,2,d=3,c=5)",
"f(1,2,e=['x','y','z'])",
"f(1... |
def f(n):
yield 1
a, b = n, n + 1
yield 2
yield a
yield b
a = 9999
b = 9999
for i in f(20):
print i
| [
[
2,
0,
0.35,
0.6,
0,
0.66,
0,
899,
0,
1,
0,
0,
0,
0,
0
],
[
8,
1,
0.2,
0.1,
1,
0.52,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.3,
0.1,
1,
0.52,
0.25,
127,
... | [
"def f(n):\n yield 1\n a, b = n, n + 1\n yield 2\n yield a\n yield b",
" yield 1",
" a, b = n, n + 1",
" yield 2",
" yield a",
" yield b",
"a = 9999",
"b = 9999",
"for i in f(20):\n print(i)",
" print(i)"
] |
print 1|2|3|4|5|6|0x80
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(1|2|3|4|5|6|0x80)"
] |
a,b,d = [0],2,"OK"
print d
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
51,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a,b,d = [0],2,\"OK\"",
"print(d)"
] |
if "a" is not "b":
print "OK"
| [
[
4,
0,
0.75,
1,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.5,
1,
0.02,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"if \"a\" is not \"b\":\n print(\"OK\")",
" print(\"OK\")"
] |
a = [100,101,102,103,104,105,106,107]
del a[0]
print a
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = [100,101,102,103,104,105,106,107]",
"print(a)"
] |
x = 444
def f(arg):
return "OK: " + arg + ", " + str(x)
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
2,
0,
0.8333,
0.6667,
0,
0.66,
1,
899,
0,
1,
1,
0,
0,
0,
1
],
[
13,
1,
1,
0.3333,
1,
0.98,
0,... | [
"x = 444",
"def f(arg):\n return \"OK: \" + arg + \", \" + str(x)",
" return \"OK: \" + arg + \", \" + str(x)"
] |
class X: pass
x = X()
methodName = "wee"
try:
stuff = getattr(x, methodName)
except AttributeError:
raise ValueError, "no such method in %s: %s" % (x.__class__, methodName)
| [
[
3,
0,
1,
1,
0,
0.66,
0,
783,
0,
0,
0,
0,
0,
0,
0
]
] | [
"class X: pass"
] |
# Test the behaviour of sets
l = [1,2,3,4,1,1]
print l
s = set(l)
print s
# Test the addition and removal of items of a clone set
t = set(s)
print len(t), t
print len(s), s
t.add(100)
print len(t), t
print len(s), s
t.discard(2)
print len(t), t
print len(s), s
| [
[
14,
0,
0.125,
0.0625,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.1875,
0.0625,
0,
0.66,
0.0833,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.25,
0.0625,
0,
0.66,... | [
"l = [1,2,3,4,1,1]",
"print(l)",
"s = set(l)",
"print(s)",
"t = set(s)",
"print(len(t), t)",
"print(len(s), s)",
"t.add(100)",
"print(len(t), t)",
"print(len(s), s)",
"t.discard(2)",
"print(len(t), t)",
"print(len(s), s)"
] |
def test(y='K',x='Z'): print(x+y)
test('O')
| [
[
2,
0,
0.5,
0.5,
0,
0.66,
0,
224,
0,
2,
0,
0,
0,
0,
1
],
[
8,
1,
0.5,
0.5,
1,
0.64,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
224,
3,
... | [
"def test(y='K',x='Z'): print(x+y)",
"def test(y='K',x='Z'): print(x+y)",
"test('O')"
] |
wee = lambda waa, woo=False, wii=True: ("OK", waa, woo, wii)
print wee("stuff")
print wee("stuff", "dog")
print wee("stuff", "dog", "cat")
print wee("stuff", wii="lamma")
print wee(wii="lamma", waa="pocky")
print wee(wii="lamma", waa="pocky", woo="blorp")
| [
[
14,
0,
0.125,
0.125,
0,
0.66,
0,
48,
9,
0,
0,
0,
0,
0,
0
],
[
8,
0,
0.375,
0.125,
0,
0.66,
0.1667,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.5,
0.125,
0,
0.66,
0.... | [
"wee = lambda waa, woo=False, wii=True: (\"OK\", waa, woo, wii)",
"print(wee(\"stuff\"))",
"print(wee(\"stuff\", \"dog\"))",
"print(wee(\"stuff\", \"dog\", \"cat\"))",
"print(wee(\"stuff\", wii=\"lamma\"))",
"print(wee(wii=\"lamma\", waa=\"pocky\"))",
"print(wee(wii=\"lamma\", waa=\"pocky\", woo=\"blorp... |
def foo(x):
yield len(x)
yield len(x)
g = foo(range(5))
print g.next()
len = lambda y: 8
print g.next()
| [
[
2,
0,
0.25,
0.375,
0,
0.66,
0,
528,
0,
1,
0,
0,
0,
0,
2
],
[
8,
1,
0.25,
0.125,
1,
0.88,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.375,
0.125,
1,
0.88,
1,
0,... | [
"def foo(x):\n yield len(x)\n yield len(x)",
" yield len(x)",
" yield len(x)",
"g = foo(range(5))",
"print(g.next())",
"len = lambda y: 8",
"print(g.next())"
] |
class Stuff:
def __init__(self):
self.a = 0
self.b = 'b'
self.c = [1,2,3]
self.d = 100000000000000
def doit(self):
self.a += 10
self.b += 'dog'
self.c += [9,10]
self.d += 10000
s = Stuff()
s.doit()
print s.a
print s.b
print s.c
print s.d
| [
[
3,
0,
0.3158,
0.5789,
0,
0.66,
0,
710,
0,
2,
0,
0,
0,
0,
0
],
[
2,
1,
0.2105,
0.2632,
1,
0.44,
0,
555,
0,
1,
0,
0,
0,
0,
0
],
[
14,
2,
0.1579,
0.0526,
2,
0.42,
... | [
"class Stuff:\n def __init__(self):\n self.a = 0\n self.b = 'b'\n self.c = [1,2,3]\n self.d = 100000000000000\n def doit(self):\n self.a += 10",
" def __init__(self):\n self.a = 0\n self.b = 'b'\n self.c = [1,2,3]\n self.d = 100000000000000",... |
def test():
print "OK"
x = [1,test,2]
x[1]()
| [
[
2,
0,
0.375,
0.5,
0,
0.66,
0,
224,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.5,
0.25,
1,
0.36,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.5,
19... | [
"def test():\n print(\"OK\")",
" print(\"OK\")",
"x = [1,test,2]",
"x[1]()"
] |
print 234
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(234)"
] |
def test():
print "OK"
x = test
x()
| [
[
2,
0,
0.375,
0.5,
0,
0.66,
0,
224,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.5,
0.25,
1,
0.55,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.5,
19... | [
"def test():\n print(\"OK\")",
" print(\"OK\")",
"x = test",
"x()"
] |
print ord('X')
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(ord('X'))"
] |
def test():
def fnc():
print "OK"
fnc()
test()
| [
[
2,
0,
0.5,
0.8,
0,
0.66,
0,
224,
0,
0,
0,
0,
0,
0,
2
],
[
2,
1,
0.5,
0.4,
1,
0.45,
0,
499,
0,
0,
0,
0,
0,
0,
1
],
[
8,
2,
0.6,
0.2,
2,
0.46,
0,
535,
3... | [
"def test():\n def fnc():\n print(\"OK\")\n fnc()",
" def fnc():\n print(\"OK\")",
" print(\"OK\")",
" fnc()",
"test()"
] |
a = range(4)
del a[::2]
print a
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
475,
3,
1,
0,
0,
816,
10,
1
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = range(4)",
"print(a)"
] |
def f(n):
i = 0
while i < n:
yield i
i = 100
yield i
i += 1
for i in f(50):
print i
| [
[
2,
0,
0.4,
0.7,
0,
0.66,
0,
899,
0,
1,
0,
0,
0,
0,
0
],
[
14,
1,
0.2,
0.1,
1,
0.04,
0,
826,
1,
0,
0,
0,
0,
1,
0
],
[
5,
1,
0.5,
0.5,
1,
0.04,
1,
0,
0,... | [
"def f(n):\n i = 0\n while i < n:\n yield i\n i = 100\n yield i\n i += 1",
" i = 0",
" while i < n:\n yield i\n i = 100\n yield i\n i += 1",
" yield i",
" i = 100",
" yield i",
"for i in f(50):\n print(i)",
" ... |
print {(1,3):'OK'}[(1,3)]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print({(1,3):'OK'}[(1,3)])"
] |
class Stuff:
def __init__(self):
print "OK"
"""
weewaa
"""
Stuff()
| [
[
3,
0,
0.5,
0.875,
0,
0.66,
0,
710,
0,
1,
0,
0,
0,
0,
1
],
[
2,
1,
0.3125,
0.25,
1,
0.38,
0,
555,
0,
1,
0,
0,
0,
0,
1
],
[
8,
2,
0.375,
0.125,
2,
0.89,
0,
... | [
"class Stuff:\n def __init__(self):\n print(\"OK\")\n \"\"\"\n weewaa\n\n \"\"\"",
" def __init__(self):\n print(\"OK\")",
" print(\"OK\")",
" \"\"\"\n weewaa\n\n \"\"\"",
"Stuff()"
] |
print {1:'stuff', 'ok':4}
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print({1:'stuff', 'ok':4})"
] |
class x():
pass
def f(x): return x
x.hi = f
print x.hi
| [
[
3,
0,
0.25,
0.3333,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.6667,
0.1667,
0,
0.66,
0.3333,
899,
0,
1,
1,
0,
0,
0,
0
],
[
13,
1,
0.6667,
0.1667,
1,
0.76,... | [
"class x():\n pass",
"def f(x): return x",
"def f(x): return x",
"x.hi = f",
"print(x.hi)"
] |
print(int)
print(str(int))
print(repr(int))
class X:
pass
x = X()
print(str(x))
print(repr(x))
print(str(x.__class__))
print(repr(x.__class__))
print(str(X))
print(repr(X))
| [
[
8,
0,
0.0833,
0.0833,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.1667,
0.0833,
0,
0.66,
0.1,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.25,
0.0833,
0,
0.66,
... | [
"print(int)",
"print(str(int))",
"print(repr(int))",
"class X:\n pass",
"x = X()",
"print(str(x))",
"print(repr(x))",
"print(str(x.__class__))",
"print(repr(x.__class__))",
"print(str(X))",
"print(repr(X))"
] |
a = 1,2,3
print a
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = 1,2,3",
"print(a)"
] |
class Stuff(object):
def __cmp__(self, rhs):
print "stuff cmp"
return 0
class Things(object):
def __cmp__(self, rhs):
print "things cmp"
return 0
class Other(object): pass
Stuff() < Things()
Stuff() <= Things()
Stuff() > Things()
Stuff() >= Things()
Stuff() == Things()
Stuff()... | [
[
3,
0,
0.0641,
0.1026,
0,
0.66,
0,
710,
0,
1,
0,
0,
186,
0,
1
],
[
2,
1,
0.0769,
0.0769,
1,
0.4,
0,
271,
0,
2,
1,
0,
0,
0,
1
],
[
8,
2,
0.0769,
0.0256,
2,
0.76,
... | [
"class Stuff(object):\n def __cmp__(self, rhs):\n print(\"stuff cmp\")\n return 0",
" def __cmp__(self, rhs):\n print(\"stuff cmp\")\n return 0",
" print(\"stuff cmp\")",
" return 0",
"class Things(object):\n def __cmp__(self, rhs):\n print(\"things ... |
a = (1,2,3,4,5,6,7,8)
print a[5::-4]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = (1,2,3,4,5,6,7,8)",
"print(a[5::-4])"
] |
s = set([1,2,3])
copy_s = s.copy()
new_s = set(s)
copy_s.add(42)
new_s.add(13)
print s
print copy_s
print new_s
| [
[
14,
0,
0.1111,
0.1111,
0,
0.66,
0,
553,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.2222,
0.1111,
0,
0.66,
0.1429,
505,
3,
0,
0,
0,
739,
10,
1
],
[
14,
0,
0.3333,
0.1111,
0,
... | [
"s = set([1,2,3])",
"copy_s = s.copy()",
"new_s = set(s)",
"copy_s.add(42)",
"new_s.add(13)",
"print(s)",
"print(copy_s)",
"print(new_s)"
] |
def funky():
print "cheese"
def gen():
i = 0
funky()
yield 1
i += 1
g = gen()
print g.next()
| [
[
2,
0,
0.1364,
0.1818,
0,
0.66,
0,
700,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.1818,
0.0909,
1,
0.88,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
2,
0,
0.5455,
0.4545,
0,
0.66,
... | [
"def funky():\n print(\"cheese\")",
" print(\"cheese\")",
"def gen():\n i = 0\n funky()\n yield 1\n i += 1",
" i = 0",
" funky()",
" yield 1",
"g = gen()",
"print(g.next())"
] |
x = 1
t = 0
while x<=5:
t = t+x
x = x+1
print t
| [
[
14,
0,
0.1667,
0.1667,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.3333,
0.1667,
0,
0.66,
0.3333,
15,
1,
0,
0,
0,
0,
1,
0
],
[
5,
0,
0.6667,
0.5,
0,
0.66,
... | [
"x = 1",
"t = 0",
"while x<=5:\n t = t+x\n x = x+1",
" t = t+x",
" x = x+1",
"print(t)"
] |
for k in {'OK':0}: print k
| [] | [] |
for i in range(10): print i
| [] | [] |
def f(**kw):
print kw
f(a=4, b=5)
| [
[
2,
0,
0.375,
0.5,
0,
0.66,
0,
899,
0,
1,
0,
0,
0,
0,
1
],
[
8,
1,
0.5,
0.25,
1,
0.69,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.25,
0,
0.66,
1,
899,
... | [
"def f(**kw):\n print(kw)",
" print(kw)",
"f(a=4, b=5)"
] |
print "-----"
print [] and 5
print {} and 5
print False and 5
print True and 5
print "-----"
print [] or 5
print {} or 5
print False or 5
print True or 5
print "-----"
print 5 and []
print 5 and {}
print 5 and False
print 5 and True
print "-----"
print 5 or []
print 5 or {}
print 5 or False
print 5 or True
print "-----... | [
[
8,
0,
0.04,
0.04,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.08,
0.04,
0,
0.66,
0.0417,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.12,
0.04,
0,
0.66,
0.0833... | [
"print(\"-----\")",
"print([] and 5)",
"print({} and 5)",
"print(False and 5)",
"print(True and 5)",
"print(\"-----\")",
"print([] or 5)",
"print({} or 5)",
"print(False or 5)",
"print(True or 5)",
"print(\"-----\")",
"print(5 and [])",
"print(5 and {})",
"print(5 and False)",
"print(5 a... |
# Test that min & max work on dicts
d = {'foo':2, 'bar':3}
print d
print min(d)
print max(d)
| [
[
14,
0,
0.4,
0.2,
0,
0.66,
0,
355,
0,
0,
0,
0,
0,
6,
0
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.3333,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.8,
0.2,
0,
0.66,
0.6667,
... | [
"d = {'foo':2, 'bar':3}",
"print(d)",
"print(min(d))",
"print(max(d))"
] |
class X:
pass
y = X()
print "OK"
| [
[
3,
0,
0.375,
0.5,
0,
0.66,
0,
783,
0,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.5,
304,
3,
0,
0,
0,
783,
10,
1
],
[
8,
0,
1,
0.25,
0,
0.66,
1,
5... | [
"class X:\n pass",
"y = X()",
"print(\"OK\")"
] |
a = [1,2,3,4,5,6]
b = [9,9,9]
a[2] = b
print a
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.5,
0.25,
0,
0.66,
0.3333,
756,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.66... | [
"a = [1,2,3,4,5,6]",
"b = [9,9,9]",
"a[2] = b",
"print(a)"
] |
class Stuff:
def __init__(self):
def tmp():
self.things()
self.x = tmp
def things(self):
print "OK"
y = Stuff()
y.x()
| [
[
3,
0,
0.4444,
0.7778,
0,
0.66,
0,
710,
0,
3,
0,
0,
0,
0,
2
],
[
2,
1,
0.3889,
0.4444,
1,
0.33,
0,
555,
0,
1,
0,
0,
0,
0,
1
],
[
2,
2,
0.3889,
0.2222,
2,
0.14,
... | [
"class Stuff:\n def __init__(self):\n def tmp():\n self.things()\n self.x = tmp\n def things(self):\n print(\"OK\")",
" def __init__(self):\n def tmp():\n self.things()\n self.x = tmp",
" def tmp():\n self.things()",
" ... |
x = (1,3)
print {x:'OK'}[x]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = (1,3)",
"print({x:'OK'}[x])"
] |
import sys
print [x.replace("\\", "/") for x in sys.argv]
| [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"import sys",
"print([x.replace(\"\\\\\", \"/\") for x in sys.argv])"
] |
# Test behaviour of min() and max() on lists and tuples
l = ['b','a','d','c']
m = ['1','0','4','3']
print l
print m
print min(l), max(l)
print min(m), max(m)
print min(l,m), max(l,m)
t = tuple(l)
u = tuple(m)
print t
print min(t), max(t)
print min(u), max(u)
print min(t,u), max(t,u)
| [
[
14,
0,
0.1429,
0.0714,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.2143,
0.0714,
0,
0.66,
0.0833,
711,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.2857,
0.0714,
0,
0.... | [
"l = ['b','a','d','c']",
"m = ['1','0','4','3']",
"print(l)",
"print(m)",
"print(min(l), max(l))",
"print(min(m), max(m))",
"print(min(l,m), max(l,m))",
"t = tuple(l)",
"u = tuple(m)",
"print(t)",
"print(min(t), max(t))",
"print(min(u), max(u))",
"print(min(t,u), max(t,u))"
] |
a = [1,2,3,4,5,6]
b = [9,10,11]
a[::2] = b
print a
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.5,
0.25,
0,
0.66,
0.3333,
756,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.66... | [
"a = [1,2,3,4,5,6]",
"b = [9,10,11]",
"a[::2] = b",
"print(a)"
] |
def loc(): pass
def gbl(): pass
def free(): pass
def cell(): pass
def gen(): pass
def true(): pass
def var(): pass
def volatile(): pass
def package():
loc = 4
gbl = 42
cell = 19
instanceof = gbl * cell
static = instanceof
print loc, gbl, cell, instanceof, static
print true == var
print ... | [
[
2,
0,
0.0952,
0.0476,
0,
0.66,
0,
822,
0,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.1429,
0.0476,
0,
0.66,
0.1111,
198,
0,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.1905,
0.0476,
0,
0.66... | [
"def loc(): pass",
"def gbl(): pass",
"def free(): pass",
"def cell(): pass",
"def gen(): pass",
"def true(): pass",
"def var(): pass",
"def volatile(): pass",
"def package():\n loc = 4\n gbl = 42\n cell = 19\n instanceof = gbl * cell\n static = instanceof\n print(loc, gbl, cell, i... |
print "aa..bbb...ccc".replace("..", "X")
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(\"aa..bbb...ccc\".replace(\"..\", \"X\"))"
] |
class X:
def __init__(self):
print "wee"
x = X()
print repr(x)
| [
[
3,
0,
0.4,
0.6,
0,
0.66,
0,
783,
0,
1,
0,
0,
0,
0,
1
],
[
2,
1,
0.5,
0.4,
1,
0,
0,
555,
0,
1,
0,
0,
0,
0,
1
],
[
8,
2,
0.6,
0.2,
2,
0.98,
0,
535,
3,
... | [
"class X:\n def __init__(self):\n print(\"wee\")",
" def __init__(self):\n print(\"wee\")",
" print(\"wee\")",
"x = X()",
"print(repr(x))"
] |
a = [1,2,3,4,5]
print a[::-1]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = [1,2,3,4,5]",
"print(a[::-1])"
] |
s = set([1,2,3])
t = set([3,4,5])
s.symmetric_difference_update(t)
t.symmetric_difference_update(s)
print s
print s == t
print s == set([1,2,4,5])
print s == set([1,2,3])
| [
[
14,
0,
0.125,
0.125,
0,
0.66,
0,
553,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.25,
0.125,
0,
0.66,
0.1429,
15,
3,
1,
0,
0,
21,
10,
1
],
[
8,
0,
0.375,
0.125,
0,
0.66,
... | [
"s = set([1,2,3])",
"t = set([3,4,5])",
"s.symmetric_difference_update(t)",
"t.symmetric_difference_update(s)",
"print(s)",
"print(s == t)",
"print(s == set([1,2,4,5]))",
"print(s == set([1,2,3]))"
] |
x = {"hi": "there", "yo": "I'm a dawg"}
print x.items()
print x.keys()
print x.values()
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
6,
0
],
[
8,
0,
0.5,
0.25,
0,
0.66,
0.3333,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.75,
0.25,
0,
0.66,
0.6667... | [
"x = {\"hi\": \"there\", \"yo\": \"I'm a dawg\"}",
"print(x.items())",
"print(x.keys())",
"print(x.values())"
] |
def x():
y = lambda x,y,z: x*y+z
print y(5, 10, 15)
x()
| [
[
2,
0,
0.5,
0.75,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
0,
2
],
[
14,
1,
0.5,
0.25,
1,
0.23,
0,
304,
9,
0,
0,
0,
0,
0,
0
],
[
8,
1,
0.75,
0.25,
1,
0.23,
1,
535,
... | [
"def x():\n y = lambda x,y,z: x*y+z\n print(y(5, 10, 15))",
" y = lambda x,y,z: x*y+z",
" print(y(5, 10, 15))",
"x()"
] |
print [y for x in range(10) for y in range(x)]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print([y for x in range(10) for y in range(x)])"
] |
def f():
a = "dog"
print "f", a
def g():
a = "cat"
print "g", a
g()
print "f2", a
def h():
print "h",a
h()
f()
| [
[
2,
0,
0.4615,
0.8462,
0,
0.66,
0,
899,
0,
0,
0,
0,
0,
0,
6
],
[
14,
1,
0.1538,
0.0769,
1,
0.96,
0,
475,
1,
0,
0,
0,
0,
3,
0
],
[
8,
1,
0.2308,
0.0769,
1,
0.96,
... | [
"def f():\n a = \"dog\"\n print(\"f\", a)\n def g():\n a = \"cat\"\n print(\"g\", a)\n g()\n print(\"f2\", a)",
" a = \"dog\"",
" print(\"f\", a)",
" def g():\n a = \"cat\"\n print(\"g\", a)",
" a = \"cat\"",
" print(\"g\", a)",
" g()"... |
v = [3,2,1]
v.sort()
print v[0]
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
553,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
489,
3,
0,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.3333,
0,
0.66,
1... | [
"v = [3,2,1]",
"v.sort()",
"print(v[0])"
] |
def yrange(n):
for i in range(n):
yield i
def zrange(n):
for y in yrange(n):
yield y
print list(zrange(5))
| [
[
2,
0,
0.2222,
0.3333,
0,
0.66,
0,
187,
0,
1,
0,
0,
0,
0,
1
],
[
6,
1,
0.2778,
0.2222,
1,
0.4,
0,
826,
3,
0,
0,
0,
0,
0,
1
],
[
8,
2,
0.3333,
0.1111,
2,
0.07,
... | [
"def yrange(n):\n for i in range(n):\n yield i",
" for i in range(n):\n yield i",
" yield i",
"def zrange(n):\n for y in yrange(n):\n yield y",
" for y in yrange(n):\n yield y",
" yield y",
"print(list(zrange(5)))"
] |
def test(): pass
x = 1
print test()
| [
[
2,
0,
0.3333,
0.3333,
0,
0.66,
0,
224,
0,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
190,
1,
0,
0,
0,
0,
1,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
1... | [
"def test(): pass",
"x = 1",
"print(test())"
] |
# Test the comparison of sets
l = [1,2,3,4,1,1]
print l
s = set(l)
print s
print '# equal'
eq = set(l)
print eq
print '# forwards'
print s.isdisjoint(eq)
print s > eq
print s.issuperset(eq)
print s >= eq
print s == eq
print s != eq
print s.issubset(eq)
print s <= eq
print s < eq
print '# backwards'
print eq.isdisjoi... | [
[
14,
0,
0.0645,
0.0323,
0,
0.66,
0,
810,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.0968,
0.0323,
0,
0.66,
0.0385,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.129,
0.0323,
0,
0.6... | [
"l = [1,2,3,4,1,1]",
"print(l)",
"s = set(l)",
"print(s)",
"print('# equal')",
"eq = set(l)",
"print(eq)",
"print('# forwards')",
"print(s.isdisjoint(eq))",
"print(s > eq)",
"print(s.issuperset(eq))",
"print(s >= eq)",
"print(s == eq)",
"print(s != eq)",
"print(s.issubset(eq))",
"print... |
def xyz(): pass
print xyz
class X:
def abc(self): pass
print X.abc
print X().abc
| [
[
2,
0,
0.125,
0.125,
0,
0.66,
0,
164,
0,
0,
0,
0,
0,
0,
0
],
[
8,
0,
0.25,
0.125,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
1
],
[
3,
0,
0.5625,
0.25,
0,
0.66,
0.5... | [
"def xyz(): pass",
"print(xyz)",
"class X:\n def abc(self): pass",
" def abc(self): pass",
"print(X.abc)",
"print(X().abc)"
] |
X = "OK"
def test(): print(X)
test()
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
783,
1,
0,
0,
0,
0,
3,
0
],
[
2,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
224,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.6667,
0.3333,
1,
0.92,
... | [
"X = \"OK\"",
"def test(): print(X)",
"def test(): print(X)",
"test()"
] |
print {'a':[1,2,3], 'b':(5,6,7), 999: {'ok':1, 'stuff':2}}
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print({'a':[1,2,3], 'b':(5,6,7), 999: {'ok':1, 'stuff':2}})"
] |
x = [1,2,]
print x[1]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = [1,2,]",
"print(x[1])"
] |
print max(3,8,2,6)
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(max(3,8,2,6))"
] |
x = (1,3)
y = (1,3)
print {x:'OK'}[y]
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
304,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
... | [
"x = (1,3)",
"y = (1,3)",
"print({x:'OK'}[y])"
] |
print 2**3
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2**3)"
] |
x = [10] * 5
x[:3] += 100,100
print x
| [
[
14,
0,
0.2,
0.2,
0,
0.66,
0,
190,
4,
0,
0,
0,
0,
0,
0
],
[
8,
0,
1,
0.2,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = [10] * 5",
"print(x)"
] |
print str(range(4))[:5]
print len(range(4))
print range(4)[0]
print range(4)[1]
print range(4)[-1]
| [
[
8,
0,
0.2,
0.2,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
3
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.5,
535,
... | [
"print(str(range(4))[:5])",
"print(len(range(4)))",
"print(range(4)[0])",
"print(range(4)[1])",
"print(range(4)[-1])"
] |
# Test that min & max work on sets
s = set([1,2,3])
print s
print min(s)
print max(s)
| [
[
14,
0,
0.4,
0.2,
0,
0.66,
0,
553,
3,
1,
0,
0,
21,
10,
1
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.3333,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.8,
0.2,
0,
0.66,
0.6667,
... | [
"s = set([1,2,3])",
"print(s)",
"print(min(s))",
"print(max(s))"
] |
print 1 in {1:2}
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(1 in {1:2})"
] |
a = [1,2,3,4,5,6]
b = [9,9,9]
a[1:5] = b
print a
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.5,
0.25,
0,
0.66,
0.3333,
756,
0,
0,
0,
0,
0,
5,
0
],
[
14,
0,
0.75,
0.25,
0,
0.66,
0.66... | [
"a = [1,2,3,4,5,6]",
"b = [9,9,9]",
"a[1:5] = b",
"print(a)"
] |
def wee(waa, woo=False, wii=True):
print "OK", waa, woo, wii
wee("stuff")
wee("stuff", "dog")
wee("stuff", "dog", "cat")
wee("stuff", wii="lamma")
wee(wii="lamma", waa="pocky")
wee(wii="lamma", waa="pocky", woo="blorp")
| [
[
2,
0,
0.1667,
0.2222,
0,
0.66,
0,
48,
0,
3,
0,
0,
0,
0,
1
],
[
8,
1,
0.2222,
0.1111,
1,
0.46,
0,
535,
3,
4,
0,
0,
0,
0,
1
],
[
8,
0,
0.4444,
0.1111,
0,
0.66,
... | [
"def wee(waa, woo=False, wii=True):\n print(\"OK\", waa, woo, wii)",
" print(\"OK\", waa, woo, wii)",
"wee(\"stuff\")",
"wee(\"stuff\", \"dog\")",
"wee(\"stuff\", \"dog\", \"cat\")",
"wee(\"stuff\", wii=\"lamma\")",
"wee(wii=\"lamma\", waa=\"pocky\")",
"wee(wii=\"lamma\", waa=\"pocky\", woo=\"bl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.