statistics
jsfuck
// Since Node 10, we're using Mocha. // You can use `chai` for assertions. const chai = require("chai"); const assert = chai.assert; // Uncomment the following line to disable truncating failure messages for deep equals, do: // chai.config.truncateThreshold = 0; // Since Node 12, we no longer include assertions from our deprecated custom test framework by default. // Uncomment the following to use the old assertions: // const Test = require("@codewars/test-compat"); var a = 1; describe("Solution", function() { it("Change 'a' to 10", function() { eval("[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]])+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]])()((![]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+[+!+[]]+[+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](+[![]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]])[!+[]+!+[]+[+!+[]]])") }); });
- // Since Node 10, we're using Mocha.
- // You can use `chai` for assertions.
- const chai = require("chai");
- const assert = chai.assert;
- // Uncomment the following line to disable truncating failure messages for deep equals, do:
- // chai.config.truncateThreshold = 0;
- // Since Node 12, we no longer include assertions from our deprecated custom test framework by default.
- // Uncomment the following to use the old assertions:
- // const Test = require("@codewars/test-compat");
- var a = 1;
- describe("Solution", function() {
- it("Change 'a' to 10", function() {
a = 10;- eval("[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]])+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]])()((![]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[+!+[]]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+[+!+[]]+[+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](+[![]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]])[!+[]+!+[]+[+!+[]]])")
- });
- });
different slice
short
import codewars_test as test from solution import ret_1 @test.describe("Example") def test_group(): @test.it("test case") def test_case(): for n in range(100): test.assert_equals(ret_1(), 1)
- import codewars_test as test
- from solution import ret_1
- @test.describe("Example")
- def test_group():
- @test.it("test case")
- def test_case():
- for n in range(100):
test.assert_equals(ret_1(n), 1)- test.assert_equals(ret_1(), 1)
might not be right, idk
class Solution: def __init__(self, n, lst1, lst2): self.n = n self.lst1 = lst1 self.lst2 = lst2 def xor_list(self): return not ((self.n in self.lst1 and self.n in self.lst2)) if (self.lst1.count(self.n) != 0 or self.lst2.count(self.n) != 0) else False
- class Solution:
- def __init__(self, n, lst1, lst2):
- self.n = n
- self.lst1 = lst1
- self.lst2 = lst2
- def xor_list(self):
return self.n in self.lst1 and self.n not in self.lst2 or self.n in self.lst2 and self.n not in self.lst1- return not ((self.n in self.lst1 and self.n in self.lst2)) if (self.lst1.count(self.n) != 0 or self.lst2.count(self.n) != 0) else False
changed to one method, made it short
def replace_key(d, k1, k2):d[k2]=d.pop(k1);return d
class Solution:def __init__(self , d:dict):self.d = ddef rename_dict_key(self, old, new):self.d[new] = self.d.pop(old)return self.d- def replace_key(d, k1, k2):d[k2]=d.pop(k1);return d
import codewars_test as test from solution import replace_key @test.describe("Example") def test_group(): @test.it("test case") def test_case(): sample = { 'code': 'challenge', 'python': 'progrmaming', 'mysql': 'database', 'horror': 'movies' } test.assert_equals(replace_key(sample, 'code', 'kumite'),{'kumite': 'challenge','python': 'progrmaming','mysql': 'database', 'horror': 'movies'}) sample = { 'code': 'challenge', 'python': 'progrmaming', 'mysql': 'database', 'horror': 'movies' } test.assert_equals(replace_key(sample, 'python', 'c++'),{'code': 'challenge','c++': 'progrmaming','mysql': 'database', 'horror': 'movies'}) sample = { 'code': 'challenge', 'python': 'progrmaming', 'mysql': 'database', 'horror': 'movies' } test.assert_equals(replace_key(sample, 'mysql', 'sqlite3'),{'code': 'challenge','python': 'progrmaming','sqlite3': 'database', 'horror': 'movies'}) sample = { 'code': 'challenge', 'python': 'progrmaming', 'mysql': 'database', 'horror': 'movies' } test.assert_equals(replace_key(sample, 'horror', 'thriller'),{'code': 'challenge','python': 'progrmaming','mysql': 'database', 'thriller': 'movies'})
- import codewars_test as test
from solution import Solution- from solution import replace_key
- @test.describe("Example")
- def test_group():
- @test.it("test case")
- def test_case():
- sample = {
- 'code': 'challenge',
- 'python': 'progrmaming',
- 'mysql': 'database',
- 'horror': 'movies'
- }
test.assert_equals(Solution(sample).rename_dict_key('code', 'kumite'),{'kumite': 'challenge','python': 'progrmaming','mysql': 'database', 'horror': 'movies'})- test.assert_equals(replace_key(sample, 'code', 'kumite'),{'kumite': 'challenge','python': 'progrmaming','mysql': 'database', 'horror': 'movies'})
- sample = {
- 'code': 'challenge',
- 'python': 'progrmaming',
- 'mysql': 'database',
- 'horror': 'movies'
- }
test.assert_equals(Solution(sample).rename_dict_key('python', 'c++'),{'code': 'challenge','c++': 'progrmaming','mysql': 'database', 'horror': 'movies'})- test.assert_equals(replace_key(sample, 'python', 'c++'),{'code': 'challenge','c++': 'progrmaming','mysql': 'database', 'horror': 'movies'})
- sample = {
- 'code': 'challenge',
- 'python': 'progrmaming',
- 'mysql': 'database',
- 'horror': 'movies'
- }
test.assert_equals(Solution(sample).rename_dict_key('mysql', 'sqlite3'),{'code': 'challenge','python': 'progrmaming','sqlite3': 'database', 'horror': 'movies'})- test.assert_equals(replace_key(sample, 'mysql', 'sqlite3'),{'code': 'challenge','python': 'progrmaming','sqlite3': 'database', 'horror': 'movies'})
- sample = {
- 'code': 'challenge',
- 'python': 'progrmaming',
- 'mysql': 'database',
- 'horror': 'movies'
- }
test.assert_equals(Solution(sample).rename_dict_key('horror', 'thriller'),{'code': 'challenge','python': 'progrmaming','mysql': 'database', 'thriller': 'movies'})- test.assert_equals(replace_key(sample, 'horror', 'thriller'),{'code': 'challenge','python': 'progrmaming','mysql': 'database', 'thriller': 'movies'})
exec time
exec("".join([chr(i)for i in[101,118,101,110,95,111,114,95,111,100,100,61,108,97,109,98,100,97,32,95,58,39,69,118,101,110,39,105,102,32,95,95,105,109,112,111,114,116,95,95,40,34,109,97,116,104,34,41,46,114,101,109,97,105,110,100,101,114,40,95,44,50,41,61,61,48,32,101,108,115,101,39,79,100,100,39]]))
q9igropqwepoifqpowiepowqihgpoqiwheiophPOIOIHPOIWHOPIEHOPIEFHPOIpiurepiuhfafoiuh3awiuoiueaheiouhwoiu=lambda _:"".join(chr(_) for _ in (69, 118, 101, 110)) if __import__("".join(chr(_) for _ in (109, 97, 116, 104))).remainder(_,True+True)==False else "".join(chr(_) for _ in (79, 100, 100))even_or_odd=q9igropqwepoifqpowiepowqihgpoqiwheiophPOIOIHPOIWHOPIEHOPIEFHPOIpiurepiuhfafoiuh3awiuoiueaheiouhwoiu- exec("".join([chr(i)for i in[101,118,101,110,95,111,114,95,111,100,100,61,108,97,109,98,100,97,32,95,58,39,69,118,101,110,39,105,102,32,95,95,105,109,112,111,114,116,95,95,40,34,109,97,116,104,34,41,46,114,101,109,97,105,110,100,101,114,40,95,44,50,41,61,61,48,32,101,108,115,101,39,79,100,100,39]]))
Added math
Return the remainder of x divided by y. If either x or y is 0
, return -1
.
def remainder(x, y):
if x == 0 or y == 0:
return -1
rem = x % y
return rem
import codewars_test as test
# TODO Write tests
import solution # or from solution import example
# test.assert_equals(actual, expected, [optional] message)
test.describe("Tests")
test.it("Remainder when divided by 2")
test.assert_equals(remainder(3,2), 1)
test.it("Remainder when divided by 3")
test.assert_equals(remainder(5, 3), 2)
test.it("Remainder when divided by 0")
test.assert_equals(remainder(22, 0), -1)
Fixed up the tests a little bit, switched to threading :D
from threading import Thread @spindle_speed def needle_and_thread(): for i in range(7): Thread(target=sewing_needle).start()
import concurrent.futures- from threading import Thread
- @spindle_speed
- def needle_and_thread():
with concurrent.futures.ThreadPoolExecutor() as spool:for thread in range(7):spool.submit(sewing_needle)- for i in range(7):
- Thread(target=sewing_needle).start()
import codewars_test as test from solution import needle_and_thread @test.describe("Example") def test_group(): @test.it("test case") def test_case(): tim = needle_and_thread() if tim > 1.01: test.fail("Not fast enough!") else: test.pass_()
- import codewars_test as test
- from solution import needle_and_thread
- @test.describe("Example")
- def test_group():
- @test.it("test case")
- def test_case():
test.assert_equals(needle_and_thread(), 1.01)- tim = needle_and_thread()
- if tim > 1.01:
- test.fail("Not fast enough!")
- else:
- test.pass_()
silly ord
ret_1=lambda x:ord("\x01")
exec(bytes('桳畯摬牟瑥牵彮㴱慬扭慤渠⠺⥮ㄫ', 'u16')[2:])""".............................................................................................................:;;:..........::::::::,......,:::::,,............,::,..........,::::,,.........::,....::,.........,%@@@@S:.......,@@@@@@@@+......:@@@@@@@%,..........+@@*..........%@@@@@#?,.......S@+...,@@;.........%@@%%@@#,......,@@#SSSSS;......:@@SSSS@@%..........S@@#,.........S@#SS#@@*.......#@*...,@@;........,@@;..;@@;......,@@;............:@@:...*@@,........:@@@@;.........S@?..,%@#,......#@+...,@@;........,@@*,..;;,......,@@:............:@@,...;@@:........?@%?@%.........S@?...+@#,......#@+...,@@;.........?@@@S*:........,@@S%%%%%,......:@@*++*#@S........,#@;;@@:........S@?,,:S@S.......#@#%%%S@@;.........,?#@@@@?,......,@@@@@@@#,......:@@@@@@@S:........+@#..#@*........S@@@@@@@;.......#@@@@@@@@;...........,;?S@@+......,@@+:::::.......:@@??@@%,.........S@%;;%@#,.......S@@###%;........#@?:::;@@;........:?*....%@%......,@@:............:@@,.;@@?........:@@@@@@@@;.......S@?,,...........#@+...,@@;........;@@;...%@%......,@@:............:@@:..*@@+.......?@#????#@%.......S@?.............#@+...,@@;........,S@@%?S@@+......,@@S%%%%%+......:@@:..,S@#,.....,#@*....+@@:......S@?.............#@+...,@@;.........:S@@@@@*.......,@@@@@@@@?......:@@:...:@@?.....+@@,....,#@*......S@?.............#@*...,@@;...........;++;,........,;;;;;;;;:......,;;,....:;:.....:;:..,:..:;:......:;:.............:;,...,;;,............................................................;*%?...............................................................................................,;+S#;..............................................................................................;*S@S*,.............................................................................................:*S#S*,.............................................................................................,*#S@*,.............................................................................................,+@#@?:.............................................................................................,;%%?*,..............................................................................................+***;,....,:........................................................................................:?S%+......:,.......................................................................................,*S%+......::.......................................................................................,*%?;......,;........................................................................................*%%+......:;........................................................................................*SS*......;;.......................................................................................,*SS*.....:*,.......................................................................................,?%S?,...:*;........................................................................................,*SSS+:;*?;......................................................................................,:;.+%?%??*;,......................................................................................:+*?.;%?*,,.......................................................................................,++**;.;S%+,...................................................................,,:::::,,...........,+*?+,,.+S%:.................................................................,:;+**++;;+++:........,+*%;..,,*S?,...............................................................::+++%%%*+;;;;;**:......+*%;...,;?%*,.............................................................,+?**%S#@@#??*+;;;;**:...;*%+....;???+..............................................................?S*%##@@@@@S%%%%?+;;+%?:,???....+S?*?:.............................................................;#%SS@@@@S%*+::;*%S?+:+?%?%%:..,*S?+**,............................................................,%##%S@@#?+;;:::::;*%S?;;*?%%+;+%%*;+*:.............................................................+##S*S@#?+:,,.,,:;;;;?S%+;+**?%%*+;;*+.............................................................,%##%;%#%+:........:*+;+****+***++;+*+,.............................................................:S##?:*SS;...........:+;:;++********;...............................................................;S##*:*S%;.............::;;:;;++++:,................................................................+###*:+SSS???*+:,.......,:;++;:,,,..................................................................+###?:+%#S?**?%%%*:.......:*?;:,,,::;:,.............................................................;S@@%;+%#S+::::;*?%?:.....;?*;.;*SS###%*:...........................................................?#@@#++*#S?+;;:,,:;?%+,...:?;*%##SS%%S@@#?:........................................................?##@@@%;+%S%?**++;:,:+??:...??##S?+;;+%@@@@S;,.....................................................*S?##@@%*;+SS%??**++;:,:*%;.,%##%+:;?%%S#@@@@#+,...................................................:#%*S@@#+%;:*SSS%%??*++;:,+%+?#S?;;?SSS#%??%#@@S;...................................................?#?+%#@S++%;:*SSS#S%??*++:,;S##?;*SSS??+:.,:+S@@?,.................................................,SS?;?#@S;;**;:%%:;%#S%?*++;;S#S?%###%+:,.,,..+#@S:.................................................:#S?:+S##++*%+;+S*..:%#%?*++%##S#@@#?;:;+,;:,.,*#S;.................................................;@S?;:*S#S;;?*;:?S:...*#S?**####@@#?:,,;*+:....:%S+,................................................:##%+:;?#S*+S%+;;S?....+#S?%S@@@@S*;.:?%%S?*;..,*S+,................................................,S#S?;:+S#%;+S*;:%S,....+#S??S#@#*;;:,S%%?***+,:+?;,.................................................?#S%*;;*S#S;%?;:?#+.....;S++#@@?;+SS::%S?***+*+;+;,.................................................;#S%%*;+?#@+?%;:*@?......,:+S@#+;%SS%,.;%%**+*%*%*,.................................................:%#SS%?+*S@?*%;;?@S,.....,:*#@S;;#%?S*..,?%*++?%*;,..................................................+##SS%%?%#?+%+*?%#,.....,:*@@%:*#%??S:..,%?+;+S*,...................................................,?####SSS#++%%@#*S:.....,:?@@?:?#%?*%*,::*?+:;S+,....................................................:?#@@###?:+%#@#+?:.....:;%@@*;%#%?*?#S##%?;,+S?,.....................................................,+%??SS;:;%@@#;?+,....+*%@#*+##%%*?S@#S%*:,*#+........................................................:;::::::S@@S;%?*+;;;%?S@#+?##%%**%##%?+,:%#+.............................................................,::+@@S+%**??%S#?#@S;*SSS%?*??%?+::*S#:.............................................................,:;+S@#*%+;+++*%?@@%+@*+#%%????*;;?%#?,..............................................................,:;%@@?S?*+++*?S@@*;+;:S#%%???*?%%SS:...............................................................,;:*@@%%#%%??%%@@S+::;.;##S%%%%SS#S:.................................................................::;#@S%##SSS%S@@?;::;,.:%#######*:..................................................................,::?@#*S###S?#@#+::;:,..,;*%%%?:,...................................................................,::+#%S%S#%*S#S*:::;,.......,........................................................................,::?%??%%%S##*:::::..................................................................................,;;S*+++*?%*;:;::,...................................................................................:*S%?**?%%;::::,....................................................................................,;?SS%%S%*;;::,......................................................................................,;?###S?;::,..........................................................................................,;+*+:,,.....................................................................................................................................................................................................................................................................+#;..........,?#S;..........,?#S;............;#+...........,S?...........+SS*...........+SS*,......;@@+..........%@#@@:.........%@#@@:..........:#@+..........,%@%..........+@@@@*.........+@@#@*....,?@@@;.........:@S,+@?........:@S,+@?.........*@@@+.........;#@@%..........S@:,@#,........S@;,@@,...,@%%@;.........+@?.:@S........+@?.:@S........,@S?@+.........%#*@%.........,@#..S@:.......,@#,.S@:...,;.?@;.........*@*.,@#........*@*.,@#,.......,;.*@+.........;,:@%.........:@#..%@;.......,@#..%@;......?@;.........*@*.,@#........*@*.,@#,..........*@+...........:@%.........:@#..%@;.......:@#..%@;......?@;.........*@*.:@S........+@?.:@#...........*@+...........:@%.........,@#..S@:.......,@#,.%@;......?@;.........;@%.;@%........;@%.;@%...........*@+...........:@%.........,#@,.#@,.......,#@,.#@,......?@+.........,#@?S@+........,#@?S@+...........*@+...........:@%..........?@%?@%.........?@%?@%.......*@;..........;#@@?..........;#@@?............*@+...........:@%..........,%@@S:.........,%@@S:.......,,,...........,::............,::.............,,,............,,............::,............::,......................................................................................................."""- ret_1=lambda x:ord("\x01")
import codewars_test as test from solution import ret_1 @test.describe("Example") def test_group(): @test.it("test case") def test_case(): for n in range(100): test.assert_equals(ret_1(n), 1)
- import codewars_test as test
from solution import should_return_1- from solution import ret_1
- @test.describe("Example")
- def test_group():
- @test.it("test case")
- def test_case():
- for n in range(100):
test.assert_equals(should_return_1(n), 1)- test.assert_equals(ret_1(n), 1)
Even smaller
smol
pennies = lambda x: x*100
def pennies(dollar):ffffffffff = 100*dollarreturn ffffffffff- pennies = lambda x: x*100
import codewars_test as test # TODO Write tests import solution # or from solution import example # test.assert_equals(actual, expected, [optional] message) @test.describe("Example") def test_group(): @test.it("test case") def test_case(): test.assert_equals(pennies(2), 200)
- import codewars_test as test
- # TODO Write tests
- import solution # or from solution import example
- # test.assert_equals(actual, expected, [optional] message)
- @test.describe("Example")
- def test_group():
- @test.it("test case")
- def test_case():
test.assert_equals(1 + 1, 2)- test.assert_equals(pennies(2), 200)
Smol
One line shorter!
from string import punctuation class Solution: def __init__(self, line): self.line = line def max_length_word(self): l = self.line.split(", ") for i in range(len(l))[::-1]: for j in l[i]: if j in punctuation: del l[i] break return l[[len(i) for i in l].index(max([len(i) for i in l]))]
- from string import punctuation
- class Solution:
- def __init__(self, line):
- self.line = line
- def max_length_word(self):
- l = self.line.split(", ")
- for i in range(len(l))[::-1]:
- for j in l[i]:
- if j in punctuation:
- del l[i]
- break
lens = [len(i) for i in l]return l[lens.index(max(lens))]- return l[[len(i) for i in l].index(max([len(i) for i in l]))]