Start a new Kumite
AllAgda (Beta)BF (Beta)CCFML (Beta)ClojureCOBOL (Beta)CoffeeScriptCommonLisp (Beta)CoqC++CrystalC#D (Beta)DartElixirElm (Beta)Erlang (Beta)Factor (Beta)Forth (Beta)Fortran (Beta)F#GoGroovyHaskellHaxe (Beta)Idris (Beta)JavaJavaScriptJulia (Beta)Kotlinλ Calculus (Beta)LeanLuaNASMNim (Beta)Objective-C (Beta)OCaml (Beta)Pascal (Beta)Perl (Beta)PHPPowerShell (Beta)Prolog (Beta)PureScript (Beta)PythonR (Beta)RacketRaku (Beta)Reason (Beta)RISC-V (Beta)RubyRustScalaShellSolidity (Beta)SQLSwiftTypeScriptVB (Beta)
Show only mine

Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.

You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.

A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.

Ad
Ad

this works too for 152

Code
Diff
  • Greeting=lambda name,rank=None,formal=False: lambda:f'He{["y","llo"][formal]}, {[str(rank)+" ",""][rank is None or not formal]}{name}{chr(33+formal*13)}'
    • Greeting=type("Greeting",(object,),{"__init__":lambda _,__,rank=None,formal=0:_.__dict__.update({k:y for k,y in zip(["name", "rank", "formal"],[__,rank,formal])}),"__call__":lambda _:f'He{["y","llo"][_.formal]}, {[str(_.rank)+" ",""][_.rank is None or not _.formal]}{_.name}{chr(33+_.formal*13)}'})
    • Greeting=lambda name,rank=None,formal=False: lambda:f'He{["y","llo"][formal]}, {[str(rank)+" ",""][rank is None or not formal]}{name}{chr(33+formal*13)}'
Code
Diff
  • // const reverseStr = str => [...str].reverse().join('');   <-- weak smh
    
    function reverseStr(str){return str.split("").reverse().join("")}
    
    console.log(reverseStr('hello world'));
    • // const reverseStr = str => [...str].reverse().join(''); <-- weak smh
    • function reverseStr(str)
    • {
    • let reversedstr = '';
    • stringArr = str.split('');
    • stringArr.forEach(function(char, index) {
    • reversedstr = char + reversedstr;
    • })
    • return reversedstr;
    • }
    • function reverseStr(str){return str.split("").reverse().join("")}
    • console.log(reverseStr('hello world'));
Code
Diff
  • a = [1,2,3]
    a = sorted(a)
    • a = [1,2,3]
    • b = [4,5,6]
    • #what is the answer of c?
    • def answer_of_c(answer):
    • return answer
    • a = sorted(a)
Arrays
Sorting
Code
Diff
  • import re
    
    def longest_words(array, num):
        cleaned_words = [re.sub(r'[^A-Za-z]', '', word) for word in array]
        valid_words = [word for word in cleaned_words if word]
        return sorted(valid_words, key=len, reverse=True)[:num] if num <= len(valid_words) else 'Invalid Parameters'
    
    • import re
    • def longest_words(array, num):
    • new = [k for k in sorted([''.join(re.findall(r"[A-Za-z]", j)) for j in array], key=lambda x: len(x), reverse=True) if k != '']
    • return new[:num] if num <= len(new) else 'Invalid Parameters'
    • cleaned_words = [re.sub(r'[^A-Za-z]', '', word) for word in array]
    • valid_words = [word for word in cleaned_words if word]
    • return sorted(valid_words, key=len, reverse=True)[:num] if num <= len(valid_words) else 'Invalid Parameters'

A more readable version of an overly complicated function that takes advantage of some "wat" javascript behaviour

Code
Diff
  • numMinusSeven=num=>num-7
    • f=numMinusSeven
    • =(__,_=___)=>
    • _?f(--__,--_):__
    • numMinusSeven=num=>num-7