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
Code
Diff
  • def get_combination(k, n):
        def get_factorial(x):        
            if x <= 0:return None
            if x <= 1:return 1
            return x * get_factorial(x-1)    
        if k <= 0 or n <= 0:return "n and k must be positive."
        if n < k:
            return "n must be greater than or equal to k."
        else:
            combination = get_factorial(n) / (get_factorial(n-k)*get_factorial(k)) 
            return combination 
    • def get_combination(k, n):
    • def get_factorial(x):
    • if x <= 0:return None
    • if x <= 1:return 1
    • return x * get_factorial(x-1)
    • if k <= 0 or n <= 0:
    • return "n and k must be positive."
    • if k <= 0 or n <= 0:return "n and k must be positive."
    • if n < k:
    • return "n must be greater than or equal to k."
    • else:
    • combination = get_factorial(n) / (get_factorial(n-k)*get_factorial(k))
    • return combination
Code
Diff
  • code = 'lambda code: int(len(code))*3+7'
    return_hundred = lambda n: eval(code)(code)
    
    • def return_hundred(n):
    • return (n/2)*2
    • code = 'lambda code: int(len(code))*3+7'
    • return_hundred = lambda n: eval(code)(code)

Considering leap years

Code
Diff
  • package kata
    
    // CalcAgeOnMars calculates the age on Mars from on a age on Earth 
    func CalcAgeOnMars(age int) int {
      return int(float64(age) * 365.25 / 686.97)
    }
    
    • package kata
    • // CalcAgeOnMars calculates the age on Mars from on a age on Earth
    • func CalcAgeOnMars(age int) int {
    • return age * 365 / 687
    • return int(float64(age) * 365.25 / 686.97)
    • }