Ad

Improvements

Code
Diff
  • # Effectively works with everything
    
    def new_expect_error(function, exception=Exception, message = "{} did not raise an exception of {}", parameters = []) -> bool:
        if not(isinstance(function, type(lambda:[])) and isinstance(exception, Exception) and isinstance(message, str) and isinstance(parameters, list)):
            raise TypeError('parameters input problem')
        try:
            if parameters==[]:
                function(*parameters)
            else:
                function()
        except exception:
            return True
        return False
    • # BaseException >> Exception
    • def f1(): raise Exception()
    • # Effectively works with everything
    • # BaseException >> Exception >> ArithmeticError >> ZeroDivisionError
    • def f2(): return 1 // 0
    • # BaseException >> Exception >> LookupError >> KeyError
    • def f3(): return {}[1]
    • def f0(): pass
    • def new_expect_error(function, exception=Exception, message = "{} did not raise an exception of {}", parameters = []) -> bool:
    • if not(isinstance(function, type(lambda:[])) and isinstance(exception, Exception) and isinstance(message, str) and isinstance(parameters, list)):
    • raise TypeError('parameters input problem')
    • try:
    • if parameters==[]:
    • function(*parameters)
    • else:
    • function()
    • except exception:
    • return True
    • return False
Fundamentals
Logic
Code
Diff
  • exec('exec("exec(\'_0xi=lambda a:a.__class__.__name__\')")')
    identify_data_type=_0xi
    • def identify_data_type(n):
    • return str(type(n))[8:-2]
    • exec('exec("exec(\'_0xi=lambda a:a.__class__.__name__\')")')
    • identify_data_type=_0xi
Code
Diff
  • hello_world=lambda i:['Goodbye','Hello'][i]+', World'
    • def hello_world(world):
    • return "Hello, World" if world == True else "Goodbye, World"
    • hello_world=lambda i:['Goodbye','Hello'][i]+', World'
Fundamentals
Logic
Code
Diff
  • identify_data_type=lambda i:type(i).__name__
    • def identify_data_type(n):
    • return type(n).__name__
    • identify_data_type=lambda i:type(i).__name__
Fundamentals
Strings

lets obfuscate poorly, just gotta dig a bit to find it

Code
Diff
  • let _4x5c408c18="73af22ddab9cb4";const _6x78f515ef="ec57ccc63165a2";const _0x5334e741=()=>"f38199e2edcf88";var _5x1da78b14="61f49175bf352d";const _8x22e9a61e=()=>"fcbeee09383628";let _9x06bbd677="64ed0c0c76a765";const _8xdfd86978="366769690cdd28";function _1xe9b516d0(){return "114352a3c70d30"};var _2x1a6abe0d="5703f8856e1f6a";var _0xf9284b77="a74c3160b26e3a";const _9xa1e6814f=()=>"333a314fcdd3ac";let _5x2722b9e4="44f6dd823fddb0";function _3x65f150d9(){return "4e6d417f693359"};const _2x95ae13db="d07f7f4d47aa18";const _7x117cb966=()=>"d11ad5cacaead0";var _4x7a51b9a4="eccee5f0bced7f";const _3x42e4ad3c=()=>"0752662f54d670";let _2xefc662ec="7cde3c89efdf57";const _2xdc97b525=()=>"3ab201ac5b7565";var _5x5a3ef867="055b4c2c00d9f8";const _2xace2125e=()=>"da2e7577e6415b";var _1x57aed60d="02d0d64c828040";function _1xc76ae9e8(){return "c93f53eceab3f0"};var _8x465bdabc="4f16b6cc9afc30";let _5x38085754="00741c56afd6d8";let _0x041ebfb2="51a4d02a37b044";const _7xdb747709=()=>"41e4065be801fa";var _2x1ff5c00b="d12fb2a678aab6";const _1xd8b553a5=()=>"813c9532b6286f";let _3xdcb1d0da="f3148604aec0dd";const _4xb2e4a581="12809401fde57d";const _4x0e4dfa7e=()=>"515c50f1121f3a";let _9xd61a558f="9db1be0bc0b8b4";reverseStr=s=>[...s].reverse().join``;function _9xb190026c(){return "bd5815bdad126a"};const _4x1b7c962a="f54f53ebf55c5f";function _8x3b46f7af(){return "b28c45d293cfd3"};let _9xbc152fef="8b1a150d72b441";function _1x87bd9902(){return "6c3470c57eb9b4"};let _8x6408511b="09749b3b666ddf";const _2x51837b6a="39bbebfd4f59ef";let _9x6b8f9798="b3071ace5f112f";const _6x82989519=()=>"4b73dab8f2c3d2";const _4x3bbb09d7="64c32024845faa";function _2x66907531(){return "5a66fc3a38cf48"};var _6xc7d7fc90="3b56773f53482a";var _5x34cb55a5="673a3ed22e58ea";function _9x8e1846d1(){return "14dedae52aeb36"};let _4x1b7615a1="a8de40853b6b80";var _0x190b2d9e="44c32724c7762c";var _2xe2134a36="93e3c7b39d401d";function _2xec4b7395(){return "2ea5745c103582"};let _1x63b3b95f="d533684f6299bf";function _2x04692cda(){return "7a4fd8458ebd89"};const _5x46c020ab="32bf81a3bbe9f8";let _1x03abdb70="7fbcfaac07140e";const _3x092cef93=()=>"e891ff249db6dc";var _2xcada4ded="e6b7588c64c280";var _2xefc990cc="d7d15791dfdbb8";const _3x86b8aca5=()=>"1a5cfe8b1ee2ac";var _1xf5715021="83cc733f71d0f9";const _6x38540419=()=>"ddfed66236c34a";const _1x7cf98a6b="07001608a881a0";const _2x2215b06a=()=>"5ce8ad6c6343c8";var _9xf282ec48="7ff71192fe4a79";function _2x57e16f5a(){return "46de17e4071a33"};var _9xa6a835dd="58ef25b420e26c";
    • \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0053\u0074\u0072=\u0073=>[...\u0073].\u0072\u0065\u0076\u0065\u0072\u0073\u0065().\u006a\u006f\u0069\u006e``
    • let _4x5c408c18="73af22ddab9cb4";const _6x78f515ef="ec57ccc63165a2";const _0x5334e741=()=>"f38199e2edcf88";var _5x1da78b14="61f49175bf352d";const _8x22e9a61e=()=>"fcbeee09383628";let _9x06bbd677="64ed0c0c76a765";const _8xdfd86978="366769690cdd28";function _1xe9b516d0(){return "114352a3c70d30"};var _2x1a6abe0d="5703f8856e1f6a";var _0xf9284b77="a74c3160b26e3a";const _9xa1e6814f=()=>"333a314fcdd3ac";let _5x2722b9e4="44f6dd823fddb0";function _3x65f150d9(){return "4e6d417f693359"};const _2x95ae13db="d07f7f4d47aa18";const _7x117cb966=()=>"d11ad5cacaead0";var _4x7a51b9a4="eccee5f0bced7f";const _3x42e4ad3c=()=>"0752662f54d670";let _2xefc662ec="7cde3c89efdf57";const _2xdc97b525=()=>"3ab201ac5b7565";var _5x5a3ef867="055b4c2c00d9f8";const _2xace2125e=()=>"da2e7577e6415b";var _1x57aed60d="02d0d64c828040";function _1xc76ae9e8(){return "c93f53eceab3f0"};var _8x465bdabc="4f16b6cc9afc30";let _5x38085754="00741c56afd6d8";let _0x041ebfb2="51a4d02a37b044";const _7xdb747709=()=>"41e4065be801fa";var _2x1ff5c00b="d12fb2a678aab6";const _1xd8b553a5=()=>"813c9532b6286f";let _3xdcb1d0da="f3148604aec0dd";const _4xb2e4a581="12809401fde57d";const _4x0e4dfa7e=()=>"515c50f1121f3a";let _9xd61a558f="9db1be0bc0b8b4";reverseStr=s=>[...s].reverse().join``;function _9xb190026c(){return "bd5815bdad126a"};const _4x1b7c962a="f54f53ebf55c5f";function _8x3b46f7af(){return "b28c45d293cfd3"};let _9xbc152fef="8b1a150d72b441";function _1x87bd9902(){return "6c3470c57eb9b4"};let _8x6408511b="09749b3b666ddf";const _2x51837b6a="39bbebfd4f59ef";let _9x6b8f9798="b3071ace5f112f";const _6x82989519=()=>"4b73dab8f2c3d2";const _4x3bbb09d7="64c32024845faa";function _2x66907531(){return "5a66fc3a38cf48"};var _6xc7d7fc90="3b56773f53482a";var _5x34cb55a5="673a3ed22e58ea";function _9x8e1846d1(){return "14dedae52aeb36"};let _4x1b7615a1="a8de40853b6b80";var _0x190b2d9e="44c32724c7762c";var _2xe2134a36="93e3c7b39d401d";function _2xec4b7395(){return "2ea5745c103582"};let _1x63b3b95f="d533684f6299bf";function _2x04692cda(){return "7a4fd8458ebd89"};const _5x46c020ab="32bf81a3bbe9f8";let _1x03abdb70="7fbcfaac07140e";const _3x092cef93=()=>"e891ff249db6dc";var _2xcada4ded="e6b7588c64c280";var _2xefc990cc="d7d15791dfdbb8";const _3x86b8aca5=()=>"1a5cfe8b1ee2ac";var _1xf5715021="83cc733f71d0f9";const _6x38540419=()=>"ddfed66236c34a";const _1x7cf98a6b="07001608a881a0";const _2x2215b06a=()=>"5ce8ad6c6343c8";var _9xf282ec48="7ff71192fe4a79";function _2x57e16f5a(){return "46de17e4071a33"};var _9xa6a835dd="58ef25b420e26c";
Fundamentals
Logic
Code
Diff
  • exec(__import__("marshal").loads(__import__("codecs").decode("63000000000000000000000000000000000200000040000000730c0000006400640184005a0064025300290363010000000000000000000000010000000200000043000000730a00000074007c0083016a01530029014e2902da0474797065da085f5f6e616d655f5f2901da0576616c7565a9007203000000fa083c737472696e673eda083c6c616d6264613e0100000073020000000a0072050000004e29015a126964656e746966795f646174615f747970657203000000720300000072030000007204000000da083c6d6f64756c653e0100000073020000000c00","hex")))
    • identify_data_type = lambda value: type(value).__name__
    • exec(__import__("marshal").loads(__import__("codecs").decode("63000000000000000000000000000000000200000040000000730c0000006400640184005a0064025300290363010000000000000000000000010000000200000043000000730a00000074007c0083016a01530029014e2902da0474797065da085f5f6e616d655f5f2901da0576616c7565a9007203000000fa083c737472696e673eda083c6c616d6264613e0100000073020000000a0072050000004e29015a126964656e746966795f646174615f747970657203000000720300000072030000007204000000da083c6d6f64756c653e0100000073020000000c00","hex")))
Fundamentals
Strings
Code
Diff
  • function \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0053\u0074\u0072(\u0073\u0074\u0072) {
      let \u0063\u0068\u0061\u0072\u0041\u0072\u0072\u0061\u0079 = \u0073\u0074\u0072.\u0073\u0070\u006c\u0069\u0074('');
      let \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0064\u0041\u0072\u0072\u0061\u0079 = \u0063\u0068\u0061\u0072\u0041\u0072\u0072\u0061\u0079.\u0072\u0065\u0076\u0065\u0072\u0073\u0065();
      let \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067 = \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0064\u0041\u0072\u0072\u0061\u0079.\u006a\u006f\u0069\u006e('');
      return \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067;
    }
    • reverseStr=s=>[...s].reverse``.join``
    • function \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0053\u0074\u0072(\u0073\u0074\u0072) {
    • let \u0063\u0068\u0061\u0072\u0041\u0072\u0072\u0061\u0079 = \u0073\u0074\u0072.\u0073\u0070\u006c\u0069\u0074('');
    • let \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0064\u0041\u0072\u0072\u0061\u0079 = \u0063\u0068\u0061\u0072\u0041\u0072\u0072\u0061\u0079.\u0072\u0065\u0076\u0065\u0072\u0073\u0065();
    • let \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067 = \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0064\u0041\u0072\u0072\u0061\u0079.\u006a\u006f\u0069\u006e('');
    • return \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067;
    • }
Fundamentals
Strings
Code
Diff
  • \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0053\u0074\u0072=\u0073=>[...\u0073].\u0072\u0065\u0076\u0065\u0072\u0073\u0065().\u006a\u006f\u0069\u006e``
    • var _0x166420=_0xa4af;function _0x2422(){var _0x33bc5b=['4871910JklnLq','join','23109544jDGPpr','1733730TrorPo','753612NLbCTA','4856152dchEDc','17FmwgHs','9cUVqaU','3166104fMSEuw','141898zTNcyT'];_0x2422=function(){return _0x33bc5b;};return _0x2422();}function _0xa4af(_0x26ad58,_0x23d6f1){var _0x242216=_0x2422();return _0xa4af=function(_0xa4af4d,_0x1b7146){_0xa4af4d=_0xa4af4d-0x1f4;var _0x251323=_0x242216[_0xa4af4d];return _0x251323;},_0xa4af(_0x26ad58,_0x23d6f1);}(function(_0x4d5ff3,_0x48e75c){var _0x493b6=_0xa4af,_0x56c85f=_0x4d5ff3();while(!![]){try{var _0x4652a0=-parseInt(_0x493b6(0x1f6))/0x1*(parseInt(_0x493b6(0x1f9))/0x2)+-parseInt(_0x493b6(0x1f4))/0x3+-parseInt(_0x493b6(0x1f8))/0x4+-parseInt(_0x493b6(0x1fa))/0x5+parseInt(_0x493b6(0x1fd))/0x6+parseInt(_0x493b6(0x1f5))/0x7+-parseInt(_0x493b6(0x1fc))/0x8*(-parseInt(_0x493b6(0x1f7))/0x9);if(_0x4652a0===_0x48e75c)break;else _0x56c85f['push'](_0x56c85f['shift']());}catch(_0x4e8159){_0x56c85f['push'](_0x56c85f['shift']());}}}(_0x2422,0x9e3cb),reverseStr=_0x1e6462=>[..._0x1e6462]['reverse']()[_0x166420(0x1fb)]``);
    • \u0072\u0065\u0076\u0065\u0072\u0073\u0065\u0053\u0074\u0072=\u0073=>[...\u0073].\u0072\u0065\u0076\u0065\u0072\u0073\u0065().\u006a\u006f\u0069\u006e``
Fundamentals
Strings
Code
Diff
  • var _0x166420=_0xa4af;function _0x2422(){var _0x33bc5b=['4871910JklnLq','join','23109544jDGPpr','1733730TrorPo','753612NLbCTA','4856152dchEDc','17FmwgHs','9cUVqaU','3166104fMSEuw','141898zTNcyT'];_0x2422=function(){return _0x33bc5b;};return _0x2422();}function _0xa4af(_0x26ad58,_0x23d6f1){var _0x242216=_0x2422();return _0xa4af=function(_0xa4af4d,_0x1b7146){_0xa4af4d=_0xa4af4d-0x1f4;var _0x251323=_0x242216[_0xa4af4d];return _0x251323;},_0xa4af(_0x26ad58,_0x23d6f1);}(function(_0x4d5ff3,_0x48e75c){var _0x493b6=_0xa4af,_0x56c85f=_0x4d5ff3();while(!![]){try{var _0x4652a0=-parseInt(_0x493b6(0x1f6))/0x1*(parseInt(_0x493b6(0x1f9))/0x2)+-parseInt(_0x493b6(0x1f4))/0x3+-parseInt(_0x493b6(0x1f8))/0x4+-parseInt(_0x493b6(0x1fa))/0x5+parseInt(_0x493b6(0x1fd))/0x6+parseInt(_0x493b6(0x1f5))/0x7+-parseInt(_0x493b6(0x1fc))/0x8*(-parseInt(_0x493b6(0x1f7))/0x9);if(_0x4652a0===_0x48e75c)break;else _0x56c85f['push'](_0x56c85f['shift']());}catch(_0x4e8159){_0x56c85f['push'](_0x56c85f['shift']());}}}(_0x2422,0x9e3cb),reverseStr=_0x1e6462=>[..._0x1e6462]['reverse']()[_0x166420(0x1fb)]``);
    • reverseStr=s=>[...s].reverse().join``
    • var _0x166420=_0xa4af;function _0x2422(){var _0x33bc5b=['4871910JklnLq','join','23109544jDGPpr','1733730TrorPo','753612NLbCTA','4856152dchEDc','17FmwgHs','9cUVqaU','3166104fMSEuw','141898zTNcyT'];_0x2422=function(){return _0x33bc5b;};return _0x2422();}function _0xa4af(_0x26ad58,_0x23d6f1){var _0x242216=_0x2422();return _0xa4af=function(_0xa4af4d,_0x1b7146){_0xa4af4d=_0xa4af4d-0x1f4;var _0x251323=_0x242216[_0xa4af4d];return _0x251323;},_0xa4af(_0x26ad58,_0x23d6f1);}(function(_0x4d5ff3,_0x48e75c){var _0x493b6=_0xa4af,_0x56c85f=_0x4d5ff3();while(!![]){try{var _0x4652a0=-parseInt(_0x493b6(0x1f6))/0x1*(parseInt(_0x493b6(0x1f9))/0x2)+-parseInt(_0x493b6(0x1f4))/0x3+-parseInt(_0x493b6(0x1f8))/0x4+-parseInt(_0x493b6(0x1fa))/0x5+parseInt(_0x493b6(0x1fd))/0x6+parseInt(_0x493b6(0x1f5))/0x7+-parseInt(_0x493b6(0x1fc))/0x8*(-parseInt(_0x493b6(0x1f7))/0x9);if(_0x4652a0===_0x48e75c)break;else _0x56c85f['push'](_0x56c85f['shift']());}catch(_0x4e8159){_0x56c85f['push'](_0x56c85f['shift']());}}}(_0x2422,0x9e3cb),reverseStr=_0x1e6462=>[..._0x1e6462]['reverse']()[_0x166420(0x1fb)]``);
Code
Diff
  • exec(__import__("marshal").loads(__import__("codecs").decode("63000000000000000000000000000000000200000040000000730c0000006400640184005a006402530029036301000000000000000000000001000000020000004300000073100000006401640267027c00190064031700530029044e5a07476f6f646279655a0548656c6c6f7a072c20576f726c64a9002901da016972000000007200000000fa083c737472696e673eda083c6c616d6264613e020000007302000000100072030000004e29015a0b68656c6c6f5f776f726c647200000000720000000072000000007202000000da083c6d6f64756c653e0100000073020000000c01","hex")))
    • hello_world=lambda i:['Goodbye','Hello'][i]+', World'
    • exec(__import__("marshal").loads(__import__("codecs").decode("63000000000000000000000000000000000200000040000000730c0000006400640184005a006402530029036301000000000000000000000001000000020000004300000073100000006401640267027c00190064031700530029044e5a07476f6f646279655a0548656c6c6f7a072c20576f726c64a9002901da016972000000007200000000fa083c737472696e673eda083c6c616d6264613e020000007302000000100072030000004e29015a0b68656c6c6f5f776f726c647200000000720000000072000000007202000000da083c6d6f64756c653e0100000073020000000c01","hex")))
Fundamentals
Strings
Code
Diff
  • exec(__import__('marshal').loads(bytes.fromhex("e30000000000000000000000000100000000000000f30c0000009700640084005a00640153002902630100000000000000000000000400000003000000f31800000097007c00640064006401850319000000000000000000530029024ee9ffffffffa9002901da0461726773730100000020fa083c737472696e673eda015f7207000000020000007311000000800090449814981498329814944ad00d1ef3000000004e29017207000000720400000072080000007206000000fa083c6d6f64756c653e7209000000010000007314000000f003010101e0001ed0001ed0001ed0001ed0001e7208000000")))
    • _=lambda x:x[::-1]
    • exec(__import__('marshal').loads(bytes.fromhex("e30000000000000000000000000100000000000000f30c0000009700640084005a00640153002902630100000000000000000000000400000003000000f31800000097007c00640064006401850319000000000000000000530029024ee9ffffffffa9002901da0461726773730100000020fa083c737472696e673eda015f7207000000020000007311000000800090449814981498329814944ad00d1ef3000000004e29017207000000720400000072080000007206000000fa083c6d6f64756c653e7209000000010000007314000000f003010101e0001ed0001ed0001ed0001ed0001e7208000000")))

shorter, 112chars(now) vs 259chars(prev)

Code
Diff
  • const rps=(p,z)=>p==z?'Draw!':/rockscissors|scissorspaper|paperrock/.test(p+z)?'Player 1 won!':'Player 2 won!';
    
    • function rps(player1, player2) {
    • return player1 == player2 ? 'Draw!' :
    • player1 == 'rock' && player2 == 'scissors' ||
    • player1 == 'scissors' && player2 == 'paper' ||
    • player1 == 'paper' && player2 == 'rock' ? 'Player 1 won!' : 'Player 2 won!';
    • }
    • const rps=(p,z)=>p==z?'Draw!':/rockscissors|scissorspaper|paperrock/.test(p+z)?'Player 1 won!':'Player 2 won!';
Code
Diff
  • hello_world=lambda i:['Goodbye','Hello'][i]+', World'
    • eval(compile((_:=__import__("ast")).fix_missing_locations(_.Module(body=[_.Assign(targets=[_.Name(id='hello_world', ctx=_.Store())], value=_.Lambda(args=_.arguments(posonlyargs=[], args=[_.arg(arg='_')], kwonlyargs=[], kw_defaults=[], defaults=[]), body=_.JoinedStr(values=[_.FormattedValue(value=_.Subscript(value=_.List(elts=[_.Constant(value='Goodbye'), _.Constant(value='Hello')], ctx=_.Load()), slice=_.Name(id='_', ctx=_.Load()), ctx=_.Load()), conversion=-1), _.Constant(value=', World')])))], type_ignores=[])), "", "exec"))
    • hello_world=lambda i:['Goodbye','Hello'][i]+', World'
Code
Diff
  • fn reverse(s:&str)->String{s.chars().rev().collect()}
    • fn reverse(s: &str) -> String {
    • s.chars().rev().collect()
    • }
    • fn reverse(s:&str)->String{s.chars().rev().collect()}
Fundamentals
Strings

-2 chars

Code
Diff
  • reverseStr=s=>[...s].reverse().join``
    • reverseStr=s=>[...s].reverse().join('')
    • reverseStr=s=>[...s].reverse().join``
Loading more items...