|
3566 | 3566 | {"src": "print(sorted(['bb', 'a', 'ccc'], key=len))", "output": ["['a', 'bb', 'ccc']"]}, |
3567 | 3567 | {"src": "xs = [3, 1, 2]\nxs.sort(reverse=True)\nprint(xs)", "output": ["[3, 2, 1]"]}, |
3568 | 3568 | {"src": "try:\n print('x', bad=1)\nexcept TypeError:\n print('te')", "output": ["te"]}, |
3569 | | - {"src": "try:\n list(5)\nexcept TypeError:\n print('ni')", "output": ["ni"]} |
| 3569 | + {"src": "try:\n list(5)\nexcept TypeError:\n print('ni')", "output": ["ni"]}, |
| 3570 | + {"src": "s1 = s2 = set('abc')\ns1 |= set('ad')\nprint(s1 is s2, len(s1))", "output": ["True 4"]}, |
| 3571 | + {"src": "s1 = s2 = set('abc')\ns1 &= set('ab')\nprint(s1 is s2, len(s1))", "output": ["True 2"]}, |
| 3572 | + {"src": "s1 = s2 = set('abc')\ns1 ^= set('ad')\nprint(s1 is s2, len(s1))", "output": ["True 3"]}, |
| 3573 | + {"src": "s = {1, 2}\ns |= {2, 3}\nprint(sorted(s))", "output": ["[1, 2, 3]"]}, |
| 3574 | + {"src": "s = {1, 2, 3}\ns &= {2, 3, 4}\nprint(sorted(s))", "output": ["[2, 3]"]}, |
| 3575 | + {"src": "s = {1, 2, 3}\ns ^= {3, 4}\nprint(sorted(s))", "output": ["[1, 2, 4]"]}, |
| 3576 | + {"src": "s1 = {1}\ns2 = s1 | {2}\nprint(s1 is s2, sorted(s2))", "output": ["False [1, 2]"]}, |
| 3577 | + {"src": "f = frozenset({1})\ng = f\nf |= {2}\nprint(f is g, sorted(f))", "output": ["False [1, 2]"]}, |
| 3578 | + {"src": "s = {1, 2}\ns |= set()\nprint(sorted(s))", "output": ["[1, 2]"]}, |
| 3579 | + {"src": "a = b = c = {1}\na |= {2}\nprint(b is c, sorted(a))", "output": ["True [1, 2]"]}, |
| 3580 | + {"src":"def f():\n x = 1\n def g():\n nonlocal x\n try:\n print(x)\n except NameError:\n print(\"NameError\")\n del x\n g()\nf()","output":["NameError"]}, |
| 3581 | + {"src":"def f():\n x = 5\n def g():\n return x\n return g()\nprint(f())","output":["5"]}, |
| 3582 | + {"src":"def f():\n x = 1\n def g():\n nonlocal x\n x = 9\n g()\n return x\nprint(f())","output":["9"]}, |
| 3583 | + {"src":"def f():\n y = 3\n del y\n try:\n return y\n except NameError:\n return 'NE'\nprint(f())","output":["NE"]}, |
| 3584 | + {"src":"def f():\n z = 1\n del z\n try:\n del z\n except NameError:\n print('twice')\nf()","output":["twice"]}, |
| 3585 | + {"src":"g = 5\ndel g\ntry:\n print(g)\nexcept NameError:\n print('gone')","output":["gone"]}, |
| 3586 | + {"src":"def f():\n x = 1\n def g():\n return x\n a = g()\n del x\n return a\nprint(f())","output":["1"]}, |
| 3587 | + {"src":"def f():\n x = 1\n y = 2\n def g():\n nonlocal x, y\n try:\n print(x)\n except NameError:\n print('x gone')\n print(y)\n del x\n g()\nf()","output":["x gone","2"]}, |
| 3588 | + {"src":"def f():\n x = 1\n def g():\n nonlocal x\n try:\n return x\n except NameError:\n return 'NE'\n def h():\n nonlocal x\n try:\n return x\n except NameError:\n return 'NE'\n del x\n print(g(), h())\nf()","output":["NE NE"]}, |
| 3589 | + {"src":"def f():\n x = 1\n def g():\n nonlocal x\n return x\n del x\n try:\n g()\n except NameError:\n return 'caught'\nprint(f())","output":["caught"]}, |
| 3590 | + {"src":"def f():\n x = 1\n def g():\n return x\n del x\n x = 99\n return g()\nprint(f())","output":["99"]} |
3570 | 3591 | ] |
0 commit comments