code
stringlengths
1
1.49M
vector
listlengths
0
7.38k
snippet
listlengths
0
7.38k
z = 0 for x in [1,2,3]: 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, 0, 0, 0, 0, 0, 0, 0 ], [ 8, 0, 1, 0.25, 0, 0.66, 1, 535,...
[ "z = 0", "for x in [1,2,3]:\n z += x", "print(z)" ]
def f(): for i in 1,2,3,4,5: if i == 4: return yield i print list(f())
[ [ 2, 0, 0.5, 0.8, 0, 0.66, 0, 899, 0, 0, 0, 0, 0, 0, 0 ], [ 6, 1, 0.6, 0.6, 1, 0.01, 0, 826, 0, 0, 0, 0, 0, 0, 0 ], [ 4, 2, 0.6, 0.2, 2, 0.12, 0, 0, 0, ...
[ "def f():\n for i in 1,2,3,4,5:\n if i == 4: return\n yield i", " for i in 1,2,3,4,5:\n if i == 4: return\n yield i", " if i == 4: return", " if i == 4: return", " yield i", "print(list(f()))" ]
def mygen(upto): for i in range(0, upto): print 'i',i got = yield i print 'got',got handle = mygen(3) first = True for num in handle: print 'num',num if first: print 'signalling' foo = handle.send('sig') print 'foo', foo first = False
[ [ 2, 0, 0.2, 0.3333, 0, 0.66, 0, 56, 0, 1, 0, 0, 0, 0, 3 ], [ 6, 1, 0.2333, 0.2667, 1, 0.29, 0, 826, 3, 0, 0, 0, 0, 0, 3 ], [ 8, 2, 0.2, 0.0667, 2, 0.46, 0, ...
[ "def mygen(upto):\n for i in range(0, upto):\n print('i',i)\n got = yield i\n print('got',got)", " for i in range(0, upto):\n print('i',i)\n got = yield i\n print('got',got)", " print('i',i)", " got = yield i", " print('got',got)", "handle = mygen(...
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 2^7
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(2^7)" ]
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.13, 0, 826, 0, 0, 0, 0, 0, 0, 0 ], [ 8, 2, 0.25, 0.0833, 2, 0.77, 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...
print 7^2&2
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(7^2&2)" ]
x = 4 print 1 != x < 9 print 1 != x > 9 print 4 != x < 9 print 4 == x > 9 print 4 == x < 9 print 4 == x < 9 < 14 print 4 == x < 9 < 14 > 10 print 4 == x < 9 < 14 < 10
[ [ 14, 0, 0.1111, 0.1111, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 1, 0 ], [ 8, 0, 0.2222, 0.1111, 0, 0.66, 0.125, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.3333, 0.1111, 0, 0.66...
[ "x = 4", "print(1 != x < 9)", "print(1 != x > 9)", "print(4 != x < 9)", "print(4 == x > 9)", "print(4 == x < 9)", "print(4 == x < 9 < 14)", "print(4 == x < 9 < 14 > 10)", "print(4 == x < 9 < 14 < 10)" ]
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\"])" ]
print "1234"[1:3]
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(\"1234\"[1:3])" ]
print " hello ".partition("x") print " hello ".rpartition("x")
[ [ 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(\" hello \".partition(\"x\"))", "print(\" hello \".rpartition(\"x\"))" ]
print True and True
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(True and True)" ]
print [x for x in range(1,10) if False] or ["hello" for x in range(1,10) if True]
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 3 ] ]
[ "print([x for x in range(1,10) if False] or [\"hello\" for x in range(1,10) if True])" ]
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 int(3) print int(3.2) print int(3.8) print int(-3.2) print int(-3.8) print int(013) print int(0x13) print "------" print int("3") print int("013") print "------" print int("13", 8) print int("013", 8) print "------" print int("13", 0) print int("013", 0) print int("0x13", 0) print "------" print int("13", 16) pri...
[ [ 8, 0, 0.0526, 0.0526, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ], [ 8, 0, 0.1053, 0.0526, 0, 0.66, 0.0556, 535, 3, 1, 0, 0, 0, 0, 2 ], [ 8, 0, 0.1579, 0.0526, 0, 0.66...
[ "print(int(3))", "print(int(3.2))", "print(int(3.8))", "print(int(-3.2))", "print(int(-3.8))", "print(int(0x13))", "print(\"------\")", "print(int(\"3\"))", "print(int(\"013\"))", "print(\"------\")", "print(int(\"13\", 8))", "print(int(\"013\", 8))", "print(\"------\")", "print(int(\"13\"...
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 "-".join(["O","K"])
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ] ]
[ "print(\"-\".join([\"O\",\"K\"]))" ]
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.46, 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 ...
def f(n): for i in range(n): yield i g = f(5) print g.next() print g.next() print g.next() print g.next()
[ [ 2, 0, 0.25, 0.375, 0, 0.66, 0, 899, 0, 1, 0, 0, 0, 0, 1 ], [ 6, 1, 0.3125, 0.25, 1, 0.28, 0, 826, 3, 0, 0, 0, 0, 0, 1 ], [ 8, 2, 0.375, 0.125, 2, 0.96, 0, ...
[ "def f(n):\n for i in range(n):\n yield i", " for i in range(n):\n yield i", " yield i", "g = f(5)", "print(g.next())", "print(g.next())", "print(g.next())", "print(g.next())" ]
print slice(1,2)
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ] ]
[ "print(slice(1,2))" ]
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.49, 0, 993, 0, 1, 0, 0, 0, 0, 1 ], [ 8, 2, 0.1667, 0.0556, 2, 0.5, ...
[ "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...
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)" ]
print str(range(-4))[:5] print len(range(-4))
[ [ 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))[:5])", "print(len(range(-4)))" ]
# free and cell vars in y c = "squirrel" def x(): b = "dog" print b, c def y(): a = "cat" print a,b def z(): return a,b,c return z return y() print x()()
[ [ 14, 0, 0.2143, 0.0714, 0, 0.66, 0, 411, 1, 0, 0, 0, 0, 3, 0 ], [ 2, 0, 0.6071, 0.7143, 0, 0.66, 0.5, 190, 0, 0, 1, 0, 0, 0, 3 ], [ 14, 1, 0.3571, 0.0714, 1, 0.95,...
[ "c = \"squirrel\"", "def x():\n b = \"dog\"\n print(b, c)\n def y():\n a = \"cat\"\n print(a,b)\n def z():\n return a,b,c", " b = \"dog\"", " print(b, c)", " def y():\n a = \"cat\"\n print(a,b)\n def z():\n return a,b,c\n ...
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'))" ]
def f(): for i in 1,2,3,4,5: if i % 2 == 0: continue yield i print list(f())
[ [ 2, 0, 0.4167, 0.6667, 0, 0.66, 0, 899, 0, 0, 0, 0, 0, 0, 0 ], [ 6, 1, 0.5, 0.5, 1, 0.07, 0, 826, 0, 0, 0, 0, 0, 0, 0 ], [ 4, 2, 0.5, 0.1667, 2, 0.52, 0, 0...
[ "def f():\n for i in 1,2,3,4,5:\n if i % 2 == 0: continue\n yield i", " for i in 1,2,3,4,5:\n if i % 2 == 0: continue\n yield i", " if i % 2 == 0: continue", " yield i", "print(list(f()))" ]
for i in (i*2 for i 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.59, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "for i in (i*2 for i in range(3)):\n print(i)", " print(i)" ]
s = set([2,3,4]) t = set([3,4,5]) u = set([1,3,5]) a = s.difference(t) b = u.difference(s) c = u.difference(t) print a print b print c print a == set([2]) print b == set([1,5]) print c == set([1]) d = s.difference(t, u) print d print d == set([2])
[ [ 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.difference(t)", "b = u.difference(s)", "c = u.difference(t)", "print(a)", "print(b)", "print(c)", "print(a == set([2]))", "print(b == set([1,5]))", "print(c == set([1]))", "d = s.difference(t, u)", "print(d)", "print(d ==...
print False == 0 print True == 1 print True == 2
[ [ 8, 0, 0.3333, 0.3333, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 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, 1,...
[ "print(False == 0)", "print(True == 1)", "print(True == 2)" ]
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...
[ [ 2, 0, 0.75, 1, 0, 0.66, 0, 245, 0, 2, 0, 0, 0, 0, 1 ], [ 8, 1, 1, 0.5, 1, 0.49, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "def do(fmt, val):\n print(fmt % val)", " print(fmt % val)" ]
print 7^2|4
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(7^2|4)" ]
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)" ]
class X: def __init__(self): self.px = 3 def y(self): l = "xyz" if len(l) == self.px: print "OK" x = X() x.y()
[ [ 3, 0, 0.4444, 0.7778, 0, 0.66, 0, 783, 0, 2, 0, 0, 0, 0, 2 ], [ 2, 1, 0.2778, 0.2222, 1, 0.87, 0, 555, 0, 1, 0, 0, 0, 0, 0 ], [ 14, 2, 0.3333, 0.1111, 2, 0.32, ...
[ "class X:\n def __init__(self):\n self.px = 3\n def y(self):\n l = \"xyz\"\n if len(l) == self.px:\n print(\"OK\")", " def __init__(self):\n self.px = 3", " self.px = 3", " def y(self):\n l = \"xyz\"\n if len(l) == self.px:\n p...
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))" ]
a = 4 def test(z): for i in range(0,a): z += i return z print test(1)
[ [ 14, 0, 0.1667, 0.1667, 0, 0.66, 0, 475, 1, 0, 0, 0, 0, 1, 0 ], [ 2, 0, 0.5833, 0.6667, 0, 0.66, 0.5, 224, 0, 1, 1, 0, 0, 0, 1 ], [ 6, 1, 0.5833, 0.3333, 1, 0.45, ...
[ "a = 4", "def test(z):\n for i in range(0,a):\n z += i\n return z", " for i in range(0,a):\n z += i", " return z", "print(test(1))" ]
c = "squirrel" time = 0 def x(): global time time += 1 if time == 1: b = "dog" else: b = "banana" print b, c def y(d): a = "cat" print a,b,d def z(): for i in range(10*time): yield i,a,b,c,d return z return y("blorp"...
[ [ 14, 0, 0.0455, 0.0455, 0, 0.66, 0, 411, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.0909, 0.0455, 0, 0.66, 0.25, 654, 1, 0, 0, 0, 0, 1, 0 ], [ 2, 0, 0.4773, 0.7273, 0, 0.66...
[ "c = \"squirrel\"", "time = 0", "def x():\n global time\n time += 1\n if time == 1:\n b = \"dog\"\n else:\n b = \"banana\"\n print(b, c)", " if time == 1:\n b = \"dog\"\n else:\n b = \"banana\"", " b = \"dog\"", " b = \"banana\"", " print...
a = [1,2,3,4,5,6] b = [9,9,9] a[1: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[1:2] = b", "print(a)" ]
import this
[ [ 1, 0, 1, 1, 0, 0.66, 0, 324, 0, 1, 0, 0, 324, 0, 0 ] ]
[ "import this" ]
class X: def stuff(self): pass x = X() f = getattr(x, "stuff") print f fu = getattr(X, "stuff") print fu
[ [ 3, 0, 0.25, 0.375, 0, 0.66, 0, 783, 0, 1, 0, 0, 0, 0, 0 ], [ 2, 1, 0.3125, 0.25, 1, 0.25, 0, 686, 0, 1, 0, 0, 0, 0, 0 ], [ 14, 0, 0.5, 0.125, 0, 0.66, 0.2, ...
[ "class X:\n def stuff(self):\n pass", " def stuff(self):\n pass", "x = X()", "f = getattr(x, \"stuff\")", "print(f)", "fu = getattr(X, \"stuff\")", "print(fu)" ]
def test(x): return x y = test(1)*2 + test(3)*4 + test(5)*6 print y
[ [ 2, 0, 0.375, 0.5, 0, 0.66, 0, 224, 0, 1, 1, 0, 0, 0, 0 ], [ 13, 1, 0.5, 0.25, 1, 0.4, 0, 0, 2, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.75, 0.25, 0, 0.66, 0.5, 304,...
[ "def test(x):\n return x", " return x", "y = test(1)*2 + test(3)*4 + test(5)*6", "print(y)" ]
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)" ]
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(\" \"))" ]
# test list comparisons l = [1,2,3,1] print l print l > l print l >= l print l == l print l != l print l <= l print l < l
[ [ 14, 0, 0.2222, 0.1111, 0, 0.66, 0, 810, 0, 0, 0, 0, 0, 5, 0 ], [ 8, 0, 0.3333, 0.1111, 0, 0.66, 0.1429, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.4444, 0.1111, 0, 0.6...
[ "l = [1,2,3,1]", "print(l)", "print(l > l)", "print(l >= l)", "print(l == l)", "print(l != l)", "print(l <= l)", "print(l < l)" ]
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.65, 0, ...
[ "class X: pass", "def test(): y = X()", "def test(): y = X()", "test()", "print(\"OK\")" ]
a,b = 1,2 print a+b
[ [ 14, 0, 0.5, 0.5, 0, 0.66, 0, 127, 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 = 1,2", "print(a+b)" ]
x=4 x=x*3 print x
[ [ 14, 0, 0.3333, 0.3333, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 1, 0 ], [ 14, 0, 0.6667, 0.3333, 0, 0.66, 0.5, 190, 4, 0, 0, 0, 0, 0, 0 ], [ 8, 0, 1, 0.3333, 0, 0.66, ...
[ "x=4", "x=x*3", "print(x)" ]
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.9, 0, 535, 3, 2, 0, 0, 0, 0, 1 ], [ 8, 0, 0.2, 0.05, 0, 0.66, 0.0714, 89...
[ "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, *[...
a = [100,101,102,103,104,105,106,107] del a[2:6] 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)" ]
print(abs(-5))
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ] ]
[ "print(abs(-5))" ]
print str((1,2,3)) print str([1,2,3]) print str({1:'ok', 2:'stuff'}) print str("weewaa")
[ [ 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(str((1,2,3)))", "print(str([1,2,3]))", "print(str({1:'ok', 2:'stuff'}))", "print(str(\"weewaa\"))" ]
x = [] x.append(x) print x<x
[ [ 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, 243, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 1, 0.3333, 0, 0.66, 1...
[ "x = []", "x.append(x)", "print(x<x)" ]
print "a"*15 print "dog"*19 print 40*"weee"
[ [ 8, 0, 0.3333, 0.3333, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 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, 1,...
[ "print(\"a\"*15)", "print(\"dog\"*19)", "print(40*\"weee\")" ]
print "..bbb..".replace("..", "X")
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ] ]
[ "print(\"..bbb..\".replace(\"..\", \"X\"))" ]
print 4-1
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(4-1)" ]
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({1:"OK"}[1])
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print({1:\"OK\"}[1])" ]
def f(n): i = 0 yield i i += 1 j = i yield i yield j j *= 100 i += j yield j yield i yield n + i for i in f(10): # i to conflict with body j = 999 print i
[ [ 2, 0, 0.4062, 0.75, 0, 0.66, 0, 899, 0, 1, 0, 0, 0, 0, 0 ], [ 14, 1, 0.125, 0.0625, 1, 0.73, 0, 826, 1, 0, 0, 0, 0, 1, 0 ], [ 8, 1, 0.1875, 0.0625, 1, 0.73, 0...
[ "def f(n):\n i = 0\n yield i\n i += 1\n j = i\n yield i\n yield j\n j *= 100", " i = 0", " yield i", " j = i", " yield i", " yield j", " yield j", " yield i", " yield n + i", "for i in f(10): # i to conflict with body\n j = 999\n print(i)", " ...
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 "Yes" if True else "No" print "Yes" if False else "No"
[ [ 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(\"Yes\" if True else \"No\")", "print(\"Yes\" if False else \"No\")" ]
a = () 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 = ()", "print(a)" ]
# nl continuation x = "stuff \ and \ things" print x
[ [ 14, 0, 0.6667, 0.5, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 3, 0 ], [ 8, 0, 1, 0.1667, 0, 0.66, 1, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "x = \"stuff \\\nand \\\n things\"", "print(x)" ]
print range(10)[slice(0, 5, 2)]
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 3 ] ]
[ "print(range(10)[slice(0, 5, 2)])" ]
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.89, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 8, 2, 0.3333, 0.1111, 2, 0.55, 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 False == None if not None: print "This statement evaluates to True." if None: print "This statement evaluates to False."
[ [ 8, 0, 0.1667, 0.1667, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 4, 0, 0.5833, 0.3333, 0, 0.66, 0.5, 0, 0, 0, 0, 0, 0, 0, 1 ], [ 8, 1, 0.6667, 0.1667, 1, 0.69, ...
[ "print(False == None)", "if not None:\n print(\"This statement evaluates to True.\")", " print(\"This statement evaluates to True.\")", "if None:\n print(\"This statement evaluates to False.\")", " print(\"This statement evaluates to False.\")" ]
# empty set creation print set()
[ [ 8, 0, 1, 0.5, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ] ]
[ "print(set())" ]
def f(a, b, c): print a, b, c args = [5, 6, 7] f(*args)
[ [ 2, 0, 0.3, 0.4, 0, 0.66, 0, 899, 0, 3, 0, 0, 0, 0, 1 ], [ 8, 1, 0.4, 0.2, 1, 0.75, 0, 535, 3, 3, 0, 0, 0, 0, 1 ], [ 14, 0, 0.8, 0.2, 0, 0.66, 0.5, 805, ...
[ "def f(a, b, c):\n print(a, b, c)", " print(a, b, c)", "args = [5, 6, 7]", "f(*args)" ]
print "1,2,3".split(",").index("3")
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 3 ] ]
[ "print(\"1,2,3\".split(\",\").index(\"3\"))" ]
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 7 in [1,2,3]
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(7 in [1,2,3])" ]
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.93, 0, 826, 3, 0, 0, 0, 0, 0, 1 ], [ 8, 2, 0.2, 0.0667, 2, 0.18, 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 =...
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\"))" ]
s = set([2,3,4]) t = set([3,4,5]) u = set([1,3,5]) print s s.intersection_update(t) u.intersection_update(t) print s print u print s == set([3, 4]) print u == set([3, 5]) t.intersection_update(s, u) print t print t == set([3])
[ [ 14, 0, 0.0526, 0.0526, 0, 0.66, 0, 553, 3, 1, 0, 0, 21, 10, 1 ], [ 14, 0, 0.1053, 0.0526, 0, 0.66, 0.0833, 15, 3, 1, 0, 0, 21, 10, 1 ], [ 14, 0, 0.1579, 0.0526, 0, ...
[ "s = set([2,3,4])", "t = set([3,4,5])", "u = set([1,3,5])", "print(s)", "s.intersection_update(t)", "u.intersection_update(t)", "print(s)", "print(u)", "print(s == set([3, 4]))", "print(u == set([3, 5]))", "t.intersection_update(s, u)", "print(t)", "print(t == set([3]))" ]
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)" ]
class X: pass print type(X) x = X() print type(x) print x class Y(object): pass print type(Y) y = Y() print type(y) print y
[ [ 3, 0, 0.1, 0.1, 0, 0.66, 0, 783, 0, 0, 0, 0, 0, 0, 0 ], [ 8, 0, 0.2, 0.1, 0, 0.66, 0.1111, 535, 3, 1, 0, 0, 0, 0, 2 ], [ 14, 0, 0.3, 0.1, 0, 0.66, 0.2222, ...
[ "class X: pass", "print(type(X))", "x = X()", "print(type(x))", "print(x)", "class Y(object): pass", "print(type(Y))", "y = Y()", "print(type(y))", "print(y)" ]
s = set([2,3,4]) t = set([3,4,5]) u = set([1,3,5]) print s s.difference_update(t) u.difference_update(t) print s print u print s == set([2]) print u == set([1]) s = set([2,3,4]) t = set([3,4,5]) t.difference_update(s, u) print t print t == set([5])
[ [ 14, 0, 0.0455, 0.0455, 0, 0.66, 0, 553, 3, 1, 0, 0, 21, 10, 1 ], [ 14, 0, 0.0909, 0.0455, 0, 0.66, 0.0714, 15, 3, 1, 0, 0, 21, 10, 1 ], [ 14, 0, 0.1364, 0.0455, 0, ...
[ "s = set([2,3,4])", "t = set([3,4,5])", "u = set([1,3,5])", "print(s)", "s.difference_update(t)", "u.difference_update(t)", "print(s)", "print(u)", "print(s == set([2]))", "print(u == set([1]))", "s = set([2,3,4])", "t = set([3,4,5])", "t.difference_update(s, u)", "print(t)", "print(t ==...
X = "OK" def test(): X = 4 print(X) test() print X
[ [ 14, 0, 0.1667, 0.1667, 0, 0.66, 0, 783, 1, 0, 0, 0, 0, 3, 0 ], [ 2, 0, 0.5, 0.5, 0, 0.66, 0.3333, 224, 0, 0, 0, 0, 0, 0, 1 ], [ 14, 1, 0.5, 0.1667, 1, 0.45, 0...
[ "X = \"OK\"", "def test():\n X = 4\n print(X)", " X = 4", " print(X)", "test()", "print(X)" ]
x = "abcdefghjijk" print x[:0] print x[0:]
[ [ 14, 0, 0.3333, 0.3333, 0, 0.66, 0, 190, 1, 0, 0, 0, 0, 3, 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, 1...
[ "x = \"abcdefghjijk\"", "print(x[:0])", "print(x[0:])" ]
def default_outside(x=[]): return x a = default_outside() a.append(1) print a b = default_outside() b.append(2) print b
[ [ 2, 0, 0.1667, 0.2222, 0, 0.66, 0, 862, 0, 1, 1, 0, 0, 0, 0 ], [ 13, 1, 0.2222, 0.1111, 1, 0.91, 0, 0, 2, 0, 0, 0, 0, 0, 0 ], [ 14, 0, 0.4444, 0.1111, 0, 0.66, ...
[ "def default_outside(x=[]):\n return x", " return x", "a = default_outside()", "a.append(1)", "print(a)", "b = default_outside()", "b.append(2)", "print(b)" ]
def f(n): i = 0 while i < n: yield i yield i * 10 i += 1 for i in f(10): print i
[ [ 2, 0, 0.3889, 0.6667, 0, 0.66, 0, 899, 0, 1, 0, 0, 0, 0, 0 ], [ 14, 1, 0.2222, 0.1111, 1, 0.41, 0, 826, 1, 0, 0, 0, 0, 1, 0 ], [ 5, 1, 0.5, 0.4444, 1, 0.41, 1...
[ "def f(n):\n i = 0\n while i < n:\n yield i\n yield i * 10\n i += 1", " i = 0", " while i < n:\n yield i\n yield i * 10\n i += 1", " yield i", " yield i * 10", "for i in f(10):\n print(i)", " print(i)" ]
x = [2,4,6] 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 = [2,4,6]", "print(x[1])" ]
print "imported modc" stuff = 942 things = "squirrel"
[ [ 8, 0, 0.3333, 0.3333, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 14, 0, 0.6667, 0.3333, 0, 0.66, 0.5, 686, 1, 0, 0, 0, 0, 1, 0 ], [ 14, 0, 1, 0.3333, 0, 0.66, ...
[ "print(\"imported modc\")", "stuff = 942", "things = \"squirrel\"" ]
print [x*x for x in range(10) if x % 2 == 0]
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ] ]
[ "print([x*x for x in range(10) if x % 2 == 0])" ]
print "OKx"[:-1]
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(\"OKx\"[:-1])" ]
print "1234"[-3:3]
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "print(\"1234\"[-3:3])" ]
print 'Hello'; print "stuff"; print "things"
[]
[]
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.25, 0, 555, 0, 2, 0, 0, 0, 0, 0 ], [ 14, 2, 0.4286, 0.1429, 2, 0.69, ...
[ "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()...
print len([1,2,3])
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ] ]
[ "print(len([1,2,3]))" ]
a,b = "OK" print a+b
[ [ 14, 0, 0.5, 0.5, 0, 0.66, 0, 127, 1, 0, 0, 0, 0, 3, 0 ], [ 8, 0, 1, 0.5, 0, 0.66, 1, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "a,b = \"OK\"", "print(a+b)" ]
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.84, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 13, 1, 0.75, 0.25, 1, 0.84, 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 foo(value = None): for i in [-1,0,1,2,3,4]: if i < 0: continue elif i == 0: yield 0 elif i == 1: yield 1 yield value yield 2 else: yield i print list(foo())
[ [ 2, 0, 0.5, 0.9231, 0, 0.66, 0, 528, 0, 1, 0, 0, 0, 0, 0 ], [ 6, 1, 0.5385, 0.8462, 1, 0.08, 0, 826, 0, 0, 0, 0, 0, 0, 0 ], [ 4, 2, 0.5769, 0.7692, 2, 0.8, 0, ...
[ "def foo(value = None):\n for i in [-1,0,1,2,3,4]:\n if i < 0:\n continue\n elif i == 0:\n yield 0\n elif i == 1:\n yield 1", " for i in [-1,0,1,2,3,4]:\n if i < 0:\n continue\n elif i == 0:\n yield 0\n elif i =...
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 = [100,101,102,103,104,105,106,107] del a[:] 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)" ]
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.72, 0, 826, 1, 0, 0, 0, 0, 1, 0 ], [ 8, 1, 0.2727, 0.0909, 1, 0.72, ...
[ "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())" ]
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])" ]
print slice(1,2,3)
[ [ 8, 0, 1, 1, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 2 ] ]
[ "print(slice(1,2,3))" ]
a = range(30) print a[-10::5] print a[-10::-6] a = tuple(range(30)) print a[-10::5] print a[-10::-6]
[ [ 14, 0, 0.1667, 0.1667, 0, 0.66, 0, 475, 3, 1, 0, 0, 816, 10, 1 ], [ 8, 0, 0.3333, 0.1667, 0, 0.66, 0.2, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 8, 0, 0.5, 0.1667, 0, 0.66, ...
[ "a = range(30)", "print(a[-10::5])", "print(a[-10::-6])", "a = tuple(range(30))", "print(a[-10::5])", "print(a[-10::-6])" ]
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]))" ]
# Test the comparison of sets print '# actual super & subsets' sup = set([1,2,3,4,100]) print sup sub = set([2,3,4]) print sub print '# forwards' print sup.isdisjoint(sub) print sup > sub print sup.issuperset(sub) print sup >= sub print sup == sub print sup != sub print sup.issubset(sub) print sup <= sub print sup ...
[ [ 8, 0, 0.1, 0.0333, 0, 0.66, 0, 535, 3, 1, 0, 0, 0, 0, 1 ], [ 14, 0, 0.1667, 0.0333, 0, 0.66, 0.0417, 575, 3, 1, 0, 0, 21, 10, 1 ], [ 8, 0, 0.2, 0.0333, 0, 0.66, ...
[ "print('# actual super & subsets')", "sup = set([1,2,3,4,100])", "print(sup)", "sub = set([2,3,4])", "print(sub)", "print('# forwards')", "print(sup.isdisjoint(sub))", "print(sup > sub)", "print(sup.issuperset(sub))", "print(sup >= sub)", "print(sup == sub)", "print(sup != sub)", "print(sup....
a = 3 print a
[ [ 14, 0, 0.5, 0.5, 0, 0.66, 0, 475, 1, 0, 0, 0, 0, 1, 0 ], [ 8, 0, 1, 0.5, 0, 0.66, 1, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "a = 3", "print(a)" ]
y = "\n\ The \"quick\"\n\ brown fox\n\ jumps over\n\ the 'lazy' dog.\n\ " print y
[ [ 14, 0, 0.5, 0.8571, 0, 0.66, 0, 304, 1, 0, 0, 0, 0, 3, 0 ], [ 8, 0, 1, 0.1429, 0, 0.66, 1, 535, 3, 1, 0, 0, 0, 0, 1 ] ]
[ "y = \"\\n\\\nThe \\\"quick\\\"\\n\\\nbrown fox\\n\\\njumps over\\n\\\nthe 'lazy' dog.\\n\\\n\"", "print(y)" ]