code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
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)"
] |
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.67,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"if \"a\" is \"a\":\n print(\"OK\")",
" print(\"OK\")"
] |
print () == (1,)
print () == ()
print (1,) == (1,)
print (1,2) == (3,4)
print (1,2) == (1,2)
print (1,2) == (1,)
print (1,2) == (1,2,3)
print (1,2,3) == (1,2)
print (1,2,3) == (1,2,3)
print
print () != (1,)
print () != ()
print (1,) != (1,)
print (1,2) != (3,4)
print (1,2) != (1,2)
print (1,2) != (1,)
print (1,2) != (1,2,3)
print (1,2,3) != (1,2)
print (1,2,3) != (1,2,3)
print
print () < (1,)
print () < ()
print (1,) < (1,)
print (1,2) < (3,4)
print (1,2) < (1,2)
print (1,2) < (1,)
print (1,2) < (1,2,3)
print (1,2,3) < (1,2)
print (1,2,3) < (1,2,3)
print
print () > (1,)
print () > ()
print (1,) > (1,)
print (1,2) > (3,4)
print (1,2) > (1,2)
print (1,2) > (1,)
print (1,2) > (1,2,3)
print (1,2,3) > (1,2)
print (1,2,3) > (1,2,3)
print
print () <= (1,)
print () <= ()
print (1,) <= (1,)
print (1,2) <= (3,4)
print (1,2) <= (1,2)
print (1,2) <= (1,)
print (1,2) <= (1,2,3)
print (1,2,3) <= (1,2)
print (1,2,3) <= (1,2,3)
print
print () >= (1,)
print () >= ()
print (1,) >= (1,)
print (1,2) >= (3,4)
print (1,2) >= (1,2)
print (1,2) >= (1,)
print (1,2) >= (1,2,3)
print (1,2,3) >= (1,2)
print (1,2,3) >= (1,2,3)
| [
[
8,
0,
0.0169,
0.0169,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
0,
0.0339,
0.0169,
0,
0.66,
0.0172,
0,
0,
0,
0,
0,
0,
0,
1
],
[
8,
0,
0.0508,
0.0169,
0,
0.66,
... | [
"print () == (1,)",
"print () == ()",
"print (1,) == (1,)",
"print (1,2) == (3,4)",
"print (1,2) == (1,2)",
"print (1,2) == (1,)",
"print (1,2) == (1,2,3)",
"print (1,2,3) == (1,2)",
"print (1,2,3) == (1,2,3)",
"print",
"print () != (1,)",
"print () != ()",
"print (1,) != (1,)",
"print (1,... |
print "1234"[1:3]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(\"1234\"[1:3])"
] |
for i in "skulpt": print i
| [] | [] |
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.44,
0,
499,
0,
0,
0,
0,
0,
0,
1
],
[
8,
2,
0.6,
0.2,
2,
0.13,
0,
535,
3... | [
"def test():\n def fnc():\n print(\"OK\")\n fnc()",
" def fnc():\n print(\"OK\")",
" print(\"OK\")",
" fnc()",
"test()"
] |
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)])"
] |
def f():
if 1 == 2:
yield -1
elif 1 == 1:
yield 3
else:
yield -1
print list(f())
| [
[
2,
0,
0.4444,
0.7778,
0,
0.66,
0,
899,
0,
0,
0,
0,
0,
0,
0
],
[
4,
1,
0.5,
0.6667,
1,
0.1,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
[
8,
2,
0.3333,
0.1111,
2,
0.44,
0,
... | [
"def f():\n if 1 == 2:\n yield -1\n elif 1 == 1:\n yield 3\n else:\n yield -1",
" if 1 == 2:\n yield -1\n elif 1 == 1:\n yield 3\n else:\n yield -1",
" yield -1",
" elif 1 == 1:\n yield 3\n else:\n yield -1",
" yie... |
print 2 in [1,2,3]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2 in [1,2,3])"
] |
x = 2,'OK',
print len(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,
2
]
] | [
"x = 2,'OK',",
"print(len(x))"
] |
print [c for c in "asdf"]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print([c for c in \"asdf\"])"
] |
s = 'abcd'
print s[::-1]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
553,
1,
0,
0,
0,
0,
3,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"s = 'abcd'",
"print(s[::-1])"
] |
print long
print long(3.0)
print long(3)
print type(long(3.0))
print type(long(3))
| [
[
8,
0,
0.2,
0.2,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.5,
535,
... | [
"print(long)",
"print(long(3.0))",
"print(long(3))",
"print(type(long(3.0)))",
"print(type(long(3)))"
] |
print ~True
print ~False
| [
[
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(~True)",
"print(~False)"
] |
class Stuff:
def __init__(self):
self.modes = {
'wee': self.things
}
self.modes['wee']()
def things(self):
print "OK"
Stuff()
| [
[
3,
0,
0.5,
0.8889,
0,
0.66,
0,
710,
0,
2,
0,
0,
0,
0,
2
],
[
2,
1,
0.4444,
0.5556,
1,
0.53,
0,
555,
0,
1,
0,
0,
0,
0,
1
],
[
14,
2,
0.4444,
0.3333,
2,
0.63,
0... | [
"class Stuff:\n def __init__(self):\n self.modes = {\n 'wee': self.things\n }\n self.modes['wee']()\n def things(self):\n print(\"OK\")",
" def __init__(self):\n self.modes = {\n 'wee': self.things\n }\n self.m... |
print float('inf')
print float('-inf')
| [
[
8,
0,
0.5,
0.5,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(float('inf'))",
"print(float('-inf'))"
] |
print 2+3
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(2+3)"
] |
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))"
] |
class X: pass
def test(): y = X()
test()
print "OK"
| [
[
3,
0,
0.25,
0.25,
0,
0.66,
0,
783,
0,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.5,
0.25,
0,
0.66,
0.3333,
224,
0,
0,
0,
0,
0,
0,
1
],
[
14,
1,
0.5,
0.25,
1,
0.78,
0,
... | [
"class X: pass",
"def test(): y = X()",
"def test(): y = X()",
"test()",
"print(\"OK\")"
] |
longvalue = 9999999999999L
print "%3ld" % 42
print "%d" % 42
print "%d" % 42.0
print "%d" % longvalue
print "%07.2f" % 42
print "%07.2F" % 42
print "%(foo)s" % { 'foo': 'bar' }
#print "%((foo))s" % { '(foo)': 'bar' }
print "%sx" % (103*'a')
| [
[
8,
0,
0.1111,
0.1111,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.2222,
0.1111,
0,
0.66,
0.1429,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.3333,
0.1111,
0,
0.66... | [
"print(\"%3ld\" % 42)",
"print(\"%d\" % 42)",
"print(\"%d\" % 42.0)",
"print(\"%d\" % longvalue)",
"print(\"%07.2f\" % 42)",
"print(\"%07.2F\" % 42)",
"print(\"%(foo)s\" % { 'foo': 'bar' })",
"print(\"%sx\" % (103*'a'))"
] |
print str(range(5,0,-3))[:5]
print len(range(5,0,-3))
print range(5,0,-3)[0]
print range(5,0,-3)[1]
print range(5,0,-3)[-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(5,0,-3))[:5])",
"print(len(range(5,0,-3)))",
"print(range(5,0,-3)[0])",
"print(range(5,0,-3)[1])",
"print(range(5,0,-3)[-1])"
] |
print 7 in {1:2,'a':7}
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(7 in {1:2,'a':7})"
] |
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.86,
0,
826,
3,
0,
0,
0,
0,
0,
1
],
[
8,
2,
0.3333,
0.1111,
2,
0.84,
... | [
"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)))"
] |
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)"
] |
print str.lower("Hello")
x = [4,5,0]
list.sort(x)
print x
| [
[
8,
0,
0.25,
0.25,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
],
[
14,
0,
0.5,
0.25,
0,
0.66,
0.3333,
190,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.75,
0.25,
0,
0.66,
0.6667... | [
"print(str.lower(\"Hello\"))",
"x = [4,5,0]",
"list.sort(x)",
"print(x)"
] |
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.86,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
13,
1,
0.1765,
0.0588,
1,
0.86,
... | [
"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",
" ... |
print " hello ".strip()
print " hello ".lstrip()
print " hello ".rstrip()
print " hello ".partition("l")
print " hello ".rpartition("l")
print " HELlo ".lower()
print " heLLO ".upper()
print "hi there".split(" ")
| [
[
8,
0,
0.125,
0.125,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.25,
0.125,
0,
0.66,
0.1429,
535,
3,
1,
0,
0,
0,
0,
2
],
[
8,
0,
0.375,
0.125,
0,
0.66,
0... | [
"print(\" hello \".strip())",
"print(\" hello \".lstrip())",
"print(\" hello \".rstrip())",
"print(\" hello \".partition(\"l\"))",
"print(\" hello \".rpartition(\"l\"))",
"print(\" HELlo \".lower())",
"print(\" heLLO \".upper())",
"print(\"hi there\".split(\" \"))"
] |
def do(fmt, val):
print fmt % val
do("%d", 42)
do("%x", 42)
do("%o", 42)
do("%d", 42L)
do("%x", 42L)
do("%o", 42L)
do("%d", 4200000000000L)
do("%x", 4200000000000L)
do("%o", 4200000000000L)
do("%d", 0x4200000000000L)
do("%x", 0x4200000000000L)
do("%o", 0x4200000000000L)
do("%d", 0o4200000000000L)
do("%x", 0o4200000000000L)
do("%o", 0o4200000000000L)
big = 012345670123456701234567012345670L # 32 octal digits
print big
print repr(big)
print str(big)
| [
[
2,
0,
0.75,
1,
0,
0.66,
0,
245,
0,
2,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.5,
1,
0.83,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"def do(fmt, val):\n print(fmt % val)",
" print(fmt % val)"
] |
x = 5
x &= 7
print x
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = 5",
"print(x)"
] |
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 volatile != package
package()
| [
[
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... |
def f(a, b):
print a, b
f(1, 2)
f(*[1, 2])
f(*(1, 2))
def g(a, b, *c):
print a, b, c
g(1, 2, 3)
g(1, 2, 3, 4, 5, 6)
g(*[1, 2])
g(*[1, 2, 3, 4])
g(*[1, 2, 3, 4, 5, 6, 7])
g(*(1, 2, 3, 4, 5, 6, 7))
g(1, *[7])
g(1, *[7, 8, 9])
g(1, 2, *(7,))
g(1, 2, 3, *(7, 8, 9))
| [
[
2,
0,
0.075,
0.1,
0,
0.66,
0,
899,
0,
2,
0,
0,
0,
0,
1
],
[
8,
1,
0.1,
0.05,
1,
0.13,
0,
535,
3,
2,
0,
0,
0,
0,
1
],
[
8,
0,
0.2,
0.05,
0,
0.66,
0.0714,
8... | [
"def f(a, b):\n print(a, b)",
" print(a, b)",
"f(1, 2)",
"f(*[1, 2])",
"f(*(1, 2))",
"def g(a, b, *c):\n print(a, b, c)",
" print(a, b, c)",
"g(1, 2, 3)",
"g(1, 2, 3, 4, 5, 6)",
"g(*[1, 2])",
"g(*[1, 2, 3, 4])",
"g(*[1, 2, 3, 4, 5, 6, 7])",
"g(*(1, 2, 3, 4, 5, 6, 7))",
"g(1, *[... |
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=4
x*=3
print x
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x=4",
"print(x)"
] |
print str(range(-4,-8))[:5]
print len(range(-4,-8))
| [
[
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(-4,-8))[:5])",
"print(len(range(-4,-8)))"
] |
def test(x,y):
print x
return y
test('a', 1) or test('b', 1) and test('c', 0)
| [
[
2,
0,
0.5,
0.75,
0,
0.66,
0,
224,
0,
2,
1,
0,
0,
0,
1
],
[
8,
1,
0.5,
0.25,
1,
0.44,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
13,
1,
0.75,
0.25,
1,
0.44,
1,
0,
... | [
"def test(x,y):\n print(x)\n return y",
" print(x)",
" return y",
"test('a', 1) or test('b', 1) and test('c', 0)"
] |
def do(fmt, val):
print fmt % val
# Some small ints
do("%d", 42)
do("%d", -42)
do("%d", 42L)
do("%d", -42L)
do("%d", 42.0)
do("%#x", 1)
do("%#x", 1L)
do("%#X", 1)
do("%#X", 1L)
do("%#x", 1.0)
do("%#o", 1)
do("%#o", 1L)
do("%#o", 0)
do("%#o", 0L)
do("%o", 0)
do("%o", 0L)
do("%d", 0)
do("%d", 0L)
do("%#x", 0)
do("%#x", 0L)
do("%#X", 0)
do("%#X", 0L)
do("%x", 0x42)
do("%x", -0x42)
do("%x", 0x42L)
do("%x", -0x42L)
do("%o", 042)
do("%o", -042)
do("%o", 042L)
do("%o", -042L)
| [
[
2,
0,
0.75,
1,
0,
0.66,
0,
245,
0,
2,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.5,
1,
0.22,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"def do(fmt, val):\n print(fmt % val)",
" print(fmt % val)"
] |
x = {1:2}
del x[1]
print len(x)
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
6,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"x = {1:2}",
"print(len(x))"
] |
print "xOK"[1:]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(\"xOK\"[1:])"
] |
x = 'OK'
print x[0]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
3,
0
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x = 'OK'",
"print(x[0])"
] |
from t279_sub import wee, blorp
wee()
blorp()
from t279_sub import waa as woo
woo()
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
130,
0,
2,
0,
0,
130,
0,
0
],
[
8,
0,
0.3333,
0.1667,
0,
0.66,
0.25,
48,
3,
0,
0,
0,
0,
0,
1
],
[
8,
0,
0.5,
0.1667,
0,
0.66,
... | [
"from t279_sub import wee, blorp",
"wee()",
"blorp()",
"from t279_sub import waa as woo",
"woo()"
] |
print False or False
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(False or False)"
] |
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]))"
] |
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])"
] |
def domul(a,b):
return a*b
print domul(10, 123456789876543)
print domul(876543234567, 123456789876543)
print domul(-876543234567, 123456789876543)
print domul(-876543234567, -123456789876543)
print domul(876543234567, -123456789876543)
print domul(876543234567, 10)
print domul(876543234567, -10)
| [
[
2,
0,
0.1667,
0.2222,
0,
0.66,
0,
945,
0,
2,
1,
0,
0,
0,
0
],
[
13,
1,
0.2222,
0.1111,
1,
0.7,
0,
0,
4,
0,
0,
0,
0,
0,
0
],
[
8,
0,
0.3333,
0.1111,
0,
0.66,
0... | [
"def domul(a,b):\n return a*b",
" return a*b",
"print(domul(10, 123456789876543))",
"print(domul(876543234567, 123456789876543))",
"print(domul(-876543234567, 123456789876543))",
"print(domul(-876543234567, -123456789876543))",
"print(domul(876543234567, -123456789876543))",
"print(domul(8765432... |
# Test that re-setting the value in a dict doesn't mess with its length
d = {'foo':2}
print len(d), d
d['foo'] = 13
print len(d), 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,
2,
0,
0,
0,
0,
2
],
[
14,
0,
0.8,
0.2,
0,
0.66,
0.6667,
... | [
"d = {'foo':2}",
"print(len(d), d)",
"d['foo'] = 13",
"print(len(d), d)"
] |
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])"
] |
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])"
] |
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.89,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"if \"a\" is not \"b\":\n print(\"OK\")",
" print(\"OK\")"
] |
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])"
] |
import t221_sub
print t221_sub.x
print t221_sub.f("wee")
| [
[
1,
0,
0.3333,
0.3333,
0,
0.66,
0,
801,
0,
1,
0,
0,
801,
0,
0
],
[
8,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.3333,
0,
0.66,
... | [
"import t221_sub",
"print(t221_sub.x)",
"print(t221_sub.f(\"wee\"))"
] |
if 0 == 1:
print "X"
elif 1 == 1:
print "OK"
else:
print "Y"
| [
[
4,
0,
0.5833,
1,
0,
0.66,
0,
0,
0,
0,
0,
0,
0,
0,
3
],
[
8,
1,
0.3333,
0.1667,
1,
0.07,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
4,
1,
0.75,
0.6667,
1,
0.07,
1,
0... | [
"if 0 == 1:\n print(\"X\")\nelif 1 == 1:\n print(\"OK\")\nelse:\n print(\"Y\")",
" print(\"X\")",
"elif 1 == 1:\n print(\"OK\")\nelse:\n print(\"Y\")",
" print(\"OK\")",
" print(\"Y\")"
] |
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)"
] |
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.92,
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 0xff
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(0xff)"
] |
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.42,
... | [
"X = \"OK\"",
"def test(): print(X)",
"def test(): print(X)",
"test()"
] |
class X:
pass
x = X()
print x.__class__
print str(x.__class__)
print repr(x.__class__)
| [
[
3,
0,
0.2143,
0.2857,
0,
0.66,
0,
783,
0,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5714,
0.1429,
0,
0.66,
0.25,
190,
3,
0,
0,
0,
783,
10,
1
],
[
8,
0,
0.7143,
0.1429,
0,
0.... | [
"class X:\n pass",
"x = X()",
"print(x.__class__)",
"print(str(x.__class__))",
"print(repr(x.__class__))"
] |
def yrange(n):
for i in range(n):
yield i
def creator():
r = yrange(5)
print "creator", r.next()
return r
def caller():
r = creator()
for i in r:
print "caller", i
caller()
| [
[
2,
0,
0.1333,
0.2,
0,
0.66,
0,
187,
0,
1,
0,
0,
0,
0,
1
],
[
6,
1,
0.1667,
0.1333,
1,
0.22,
0,
826,
3,
0,
0,
0,
0,
0,
1
],
[
8,
2,
0.2,
0.0667,
2,
0.95,
0,
... | [
"def yrange(n):\n for i in range(n):\n yield i",
" for i in range(n):\n yield i",
" yield i",
"def creator():\n r = yrange(5)\n print(\"creator\", r.next())\n return r",
" r = yrange(5)",
" print(\"creator\", r.next())",
" return r",
"def caller():\n r =... |
x=2
x+=3
print x
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
1,
0,
0,
0,
0,
1,
0
],
[
8,
0,
1,
0.3333,
0,
0.66,
2,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"x=2",
"print(x)"
] |
a = range(30)
print a[19::-7]
| [
[
14,
0,
0.5,
0.5,
0,
0.66,
0,
475,
3,
1,
0,
0,
816,
10,
1
],
[
8,
0,
1,
0.5,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"a = range(30)",
"print(a[19::-7])"
] |
class A:
def __init__(self):
print "at0"
self.a = 'O'
self.b = 'x'
def test(self):
print "KO"
class B(A):
def __init__(self):
print "at1"
A.__init__(self)
self.b = 'K'
def test(self):
print self.a + self.b
print "at2"
B().test()
print "at3"
| [
[
3,
0,
0.2353,
0.4118,
0,
0.66,
0,
429,
0,
2,
0,
0,
0,
0,
2
],
[
2,
1,
0.2059,
0.2353,
1,
0.69,
0,
555,
0,
1,
0,
0,
0,
0,
1
],
[
8,
2,
0.1765,
0.0588,
2,
0.31,
... | [
"class A:\n def __init__(self):\n print(\"at0\")\n self.a = 'O'\n self.b = 'x'\n def test(self):\n print(\"KO\")",
" def __init__(self):\n print(\"at0\")\n self.a = 'O'\n self.b = 'x'",
" print(\"at0\")",
" self.a = 'O'",
" self.... |
print type(1)
print type(2**10)
print type(2**1024)
print type("wee")
| [
[
8,
0,
0.25,
0.25,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
],
[
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,... | [
"print(type(1))",
"print(type(2**10))",
"print(type(2**1024))",
"print(type(\"wee\"))"
] |
s = set([1,2,3])
t = set([3,4,5])
a = s.symmetric_difference(t)
b = t.symmetric_difference(s)
print a
print a == b
print a == set([1,2,4,5])
| [
[
14,
0,
0.1429,
0.1429,
0,
0.66,
0,
553,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.2857,
0.1429,
0,
0.66,
0.1667,
15,
3,
1,
0,
0,
21,
10,
1
],
[
14,
0,
0.4286,
0.1429,
0,
... | [
"s = set([1,2,3])",
"t = set([3,4,5])",
"a = s.symmetric_difference(t)",
"b = t.symmetric_difference(s)",
"print(a)",
"print(a == b)",
"print(a == set([1,2,4,5]))"
] |
print(abs(-5))
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(abs(-5))"
] |
class Test:
def __init__(self, v):
self.value = v
def __call__(self):
print self.value
x = Test('OK')
x()
| [
[
3,
0,
0.4286,
0.7143,
0,
0.66,
0,
786,
0,
2,
0,
0,
0,
0,
1
],
[
2,
1,
0.3571,
0.2857,
1,
0.27,
0,
555,
0,
2,
0,
0,
0,
0,
0
],
[
14,
2,
0.4286,
0.1429,
2,
0.2,
... | [
"class Test:\n def __init__(self, v):\n self.value = v\n def __call__(self):\n print(self.value)",
" def __init__(self, v):\n self.value = v",
" self.value = v",
" def __call__(self):\n print(self.value)",
" print(self.value)",
"x = Test('OK')",
"x()... |
def f(l):
for i in 1,2,3,4,5:
yield l, i
a, b = f("a"), f("b")
print a.next()
print a.next()
print b.next()
print b.next()
print b.next()
print a.next()
print b.next()
print a.next()
| [
[
2,
0,
0.1667,
0.25,
0,
0.66,
0,
899,
0,
1,
0,
0,
0,
0,
0
],
[
6,
1,
0.2083,
0.1667,
1,
0.29,
0,
826,
0,
0,
0,
0,
0,
0,
0
],
[
8,
2,
0.25,
0.0833,
2,
0.25,
0,
... | [
"def f(l):\n for i in 1,2,3,4,5:\n yield l, i",
" for i in 1,2,3,4,5:\n yield l, i",
" yield l, i",
"a, b = f(\"a\"), f(\"b\")",
"print(a.next())",
"print(a.next())",
"print(b.next())",
"print(b.next())",
"print(b.next())",
"print(a.next())",
"print(b.next())",
"prin... |
z = lambda x: x
print z(4)
print z("stuff")
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
859,
9,
0,
0,
0,
0,
0,
0
],
[
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... | [
"z = lambda x: x",
"print(z(4))",
"print(z(\"stuff\"))"
] |
a = b,c = 1,2
print a[0]
print a[1]
print b
print c
| [
[
14,
0,
0.2,
0.2,
0,
0.66,
0,
475,
0,
0,
0,
0,
0,
8,
0
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.25,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.5,
535,... | [
"a = b,c = 1,2",
"print(a[0])",
"print(a[1])",
"print(b)",
"print(c)"
] |
print "hello world"
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(\"hello world\")"
] |
def test(t):
t = "O"+t
print t
test("K")
| [
[
2,
0,
0.5,
0.75,
0,
0.66,
0,
224,
0,
1,
0,
0,
0,
0,
1
],
[
14,
1,
0.5,
0.25,
1,
0.19,
0,
15,
4,
0,
0,
0,
0,
0,
0
],
[
8,
1,
0.75,
0.25,
1,
0.19,
1,
535,
... | [
"def test(t):\n t = \"O\"+t\n print(t)",
" t = \"O\"+t",
" print(t)",
"test(\"K\")"
] |
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 Stuff:
def blah(self, x, y=False):
print x,y
s = Stuff()
s.blah("x",y="OK")
| [
[
3,
0,
0.4,
0.6,
0,
0.66,
0,
710,
0,
1,
0,
0,
0,
0,
1
],
[
2,
1,
0.5,
0.4,
1,
0.77,
0,
485,
0,
3,
0,
0,
0,
0,
1
],
[
8,
2,
0.6,
0.2,
2,
0.33,
0,
535,
3... | [
"class Stuff:\n def blah(self, x, y=False):\n print(x,y)",
" def blah(self, x, y=False):\n print(x,y)",
" print(x,y)",
"s = Stuff()",
"s.blah(\"x\",y=\"OK\")"
] |
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.23,
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()"
] |
class Base(object):
def myfunc(self):
print "Base.myfunc"
def stuff(self):
print "Base.stuff"
self.myfunc()
class Derived(Base):
def myfunc(self):
Base.myfunc(self)
print "Derived.myfunc"
d = Derived()
d.myfunc()
b = Derived()
b.stuff()
| [
[
3,
0,
0.2222,
0.3889,
0,
0.66,
0,
56,
0,
2,
0,
0,
186,
0,
3
],
[
2,
1,
0.1389,
0.1111,
1,
0.87,
0,
993,
0,
1,
0,
0,
0,
0,
1
],
[
8,
2,
0.1667,
0.0556,
2,
0.42,
... | [
"class Base(object):\n def myfunc(self):\n print(\"Base.myfunc\")\n\n def stuff(self):\n print(\"Base.stuff\")\n self.myfunc()",
" def myfunc(self):\n print(\"Base.myfunc\")",
" print(\"Base.myfunc\")",
" def stuff(self):\n print(\"Base.stuff\")\n s... |
for i in (1 for x in range(3)):
print i
| [
[
6,
0,
0.75,
1,
0,
0.66,
0,
826,
5,
0,
0,
0,
0,
0,
2
],
[
8,
1,
1,
0.5,
1,
0.69,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"for i in (1 for x in range(3)):\n print(i)",
" print(i)"
] |
def gen():
i = 0
funky()
yield 1
i += 1
def funky():
print "cheese"
g = gen()
print g.next()
| [
[
2,
0,
0.2727,
0.4545,
0,
0.66,
0,
728,
0,
0,
0,
0,
0,
0,
1
],
[
14,
1,
0.1818,
0.0909,
1,
0.6,
0,
826,
1,
0,
0,
0,
0,
1,
0
],
[
8,
1,
0.2727,
0.0909,
1,
0.6,
... | [
"def gen():\n i = 0\n funky()\n yield 1\n i += 1",
" i = 0",
" funky()",
" yield 1",
"def funky():\n print(\"cheese\")",
" print(\"cheese\")",
"g = gen()",
"print(g.next())"
] |
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())"
] |
a = range(17)
del a[::3]
print a
a = range(16)
del a[::3]
print a
a = range(17)
del a[::2]
print a
a = range(16)
del a[::2]
print a
| [
[
14,
0,
0.0833,
0.0833,
0,
0.66,
0,
475,
3,
1,
0,
0,
816,
10,
1
],
[
8,
0,
0.25,
0.0833,
0,
0.66,
0.2857,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.3333,
0.0833,
0,
0... | [
"a = range(17)",
"print(a)",
"a = range(16)",
"print(a)",
"a = range(17)",
"print(a)",
"a = range(16)",
"print(a)"
] |
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)"
] |
# 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.isdisjoint(s)
print eq > s
print eq.issuperset(s)
print eq >= s
print eq == s
print eq != s
print eq.issubset(s)
print eq <= s
print eq < s
| [
[
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... |
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])"
] |
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)"
] |
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.83,
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)"
] |
for const in (1,2,3):
print const
def f():
for const in (1,2,3):
print const
for object in (1,2,3):
print object
instanceof = 5
void = 6
var = 7
delete = 8
switch = 9
default = 10
catch = 11
print instanceof, void, var, delete, switch, default, catch
f()
| [
[
6,
0,
0.0882,
0.1176,
0,
0.66,
0,
798,
0,
0,
0,
0,
0,
0,
1
],
[
8,
1,
0.1176,
0.0588,
1,
0.23,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
2,
0,
0.5882,
0.7647,
0,
0.66,
... | [
"for const in (1,2,3):\n print(const)",
" print(const)",
"def f():\n for const in (1,2,3):\n print(const)\n for object in (1,2,3):\n print(object)\n instanceof = 5\n void = 6\n var = 7",
" for const in (1,2,3):\n print(const)",
" print(const)",
" for ... |
x = [1]
x.extend([2,3])
print(x[1])
| [
[
14,
0,
0.3333,
0.3333,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.6667,
0.3333,
0,
0.66,
0.5,
660,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.3333,
0,
0.66,
1... | [
"x = [1]",
"x.extend([2,3])",
"print(x[1])"
] |
print False and False or False
print False or False and False
| [
[
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(False and False or False)",
"print(False or False and False)"
] |
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)"
] |
x = 'OK',1
print x[0]
| [
[
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 = 'OK',1",
"print(x[0])"
] |
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)"
] |
print [5]*10
print [1,2,3]*4
print (5,)*10
print (1,2,3)*4
print 10*[5]
print 4*[1,2,3]
print 10*(5,)
print 4*(1,2,3)
| [
[
8,
0,
0.125,
0.125,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.25,
0.125,
0,
0.66,
0.1429,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.375,
0.125,
0,
0.66,
0... | [
"print([5]*10)",
"print([1,2,3]*4)",
"print (5,)*10",
"print (1,2,3)*4",
"print(10*[5])",
"print(4*[1,2,3])",
"print(10*(5,))",
"print(4*(1,2,3))"
] |
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)"
] |
# 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)"
] |
x = [0, 1, 2]
print x
x.insert(2, x.pop(0))
print x
| [
[
14,
0,
0.2,
0.2,
0,
0.66,
0,
190,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.4,
0.2,
0,
0.66,
0.3333,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
0.6,
0.2,
0,
0.66,
0.6667,
... | [
"x = [0, 1, 2]",
"print(x)",
"x.insert(2, x.pop(0))",
"print(x)"
] |
print [x*y for x in range(10) if x % 2 == 0 for y in range(10)]
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
3
]
] | [
"print([x*y for x in range(10) if x % 2 == 0 for y in range(10)])"
] |
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.45,
0,
475,
1,
0,
0,
0,
0,
3,
0
],
[
8,
1,
0.2308,
0.0769,
1,
0.45,
... | [
"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()"... |
for i in range(10): print i
| [] | [] |
print "-".join(["O","K"])
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
2
]
] | [
"print(\"-\".join([\"O\",\"K\"]))"
] |
print 3*7
| [
[
8,
0,
1,
1,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(3*7)"
] |
a = range(17)
del a[::-3]
print a
a = range(16)
del a[::-3]
print a
a = range(17)
del a[::-2]
print a
a = range(16)
del a[::-2]
print a
| [
[
14,
0,
0.0833,
0.0833,
0,
0.66,
0,
475,
3,
1,
0,
0,
816,
10,
1
],
[
8,
0,
0.25,
0.0833,
0,
0.66,
0.2857,
535,
3,
1,
0,
0,
0,
0,
1
],
[
14,
0,
0.3333,
0.0833,
0,
0... | [
"a = range(17)",
"print(a)",
"a = range(16)",
"print(a)",
"a = range(17)",
"print(a)",
"a = range(16)",
"print(a)"
] |
z = 0
for x in range(1,4):
z += x
print z
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
859,
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,... | [
"z = 0",
"for x in range(1,4):\n z += x",
"print(z)"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.