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

First Kumite. Super simple problem.

Code
Diff
  • var a = 1;
    a = 10
    • var a = 1;
    • var a = 1;
    • a = 10
Code
Diff
  • def Calculator(c = "+", a = 0, b = 1):
        output = 0
        
        try: 
            output = (eval(str(a) + c + str(b)))
        except: 
            pass
        return ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~int(output)
    
     
    
    • def Calculator(c = "+", a = 0, b = 1):
    • try: return eval(str(a) + c + str(b))
    • except: return 0
    • output = 0
    • try:
    • output = (eval(str(a) + c + str(b)))
    • except:
    • pass
    • return ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~int(output)
Code
Diff
  • class TemperatureConverter:
        def __init__(self, temp: float):
            self.temp = temp
            self.fahrenheit = round((temp - 32) * (5 / 9), 2)
            self.celsius = round((temp * 9 / 5) + 32, 2)
    
    • class TemperatureConverter:
    • def __init__(self, temp: float): self.temp = temp
    • fahrenheit_to_celsius = lambda self: round((self.temp - 32) * (5 / 9), 2)
    • celsius_to_fahrenheit = lambda self: round((self.temp * 9 / 5) + 32, 2)
    • def __init__(self, temp: float):
    • self.temp = temp
    • self.fahrenheit = round((temp - 32) * (5 / 9), 2)
    • self.celsius = round((temp * 9 / 5) + 32, 2)
Code
Diff
  • is_palindrome = lambda s: (c_s := [*map(str.lower,filter(str.isalpha,[*s]))]) == c_s[::-1] 
    • import re
    • def is_palindrome(s: str) -> bool:
    • s = re.sub('[^a-z]', '', s.lower())
    • return s == s[::-1]
    • is_palindrome = lambda s: (c_s := [*map(str.lower,filter(str.isalpha,[*s]))]) == c_s[::-1]
Strings
Mathematics
Code
Diff
  • fn math(s: &str) -> i32 {
        // remove whitespace characters so all we have left are digits and the operator
        let math_str: String = s.chars().filter(|ch| !ch.is_whitespace()).collect();
        
        // find the position of the operator character
        let pos: usize = math_str    
            .chars()
            .position(|ch| ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '=')
            .expect("invalid operator, expected +, -, *, / or =");
        
        // extract the two numbers from the string
        let num1: i32 = math_str[..pos].parse().unwrap();
        let num2: i32 = math_str[pos + 1..].parse().unwrap();
        
        match &math_str[pos..pos + 1] {
            "+" => num1 + num2,
            "-" => num1 - num2,
            "*" => num1 * num2,
            "/" => num1 / num2,
            _ => (num1 == num2) as i32,
        }
    }
    • fn math(s: &str) -> i32 {
    • // first remove whitespace characters so all we have left are digits and the operator
    • let num_str: String = s.chars().filter(|ch| *ch != ' ').collect();
    • // remove whitespace characters so all we have left are digits and the operator
    • let math_str: String = s.chars().filter(|ch| !ch.is_whitespace()).collect();
    • // extract the operator character
    • let pos: usize = num_str
    • // find the position of the operator character
    • let pos: usize = math_str
    • .chars()
    • .position(|ch| ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '=')
    • .expect("invalid operator, expected '+, -, *, / or =");
    • let operator: char = num_str
    • .chars()
    • .nth(pos)
    • .unwrap();
    • .expect("invalid operator, expected +, -, *, / or =");
    • // extract the two numbers from the string
    • let num1: i32 = num_str.get(0..pos).unwrap().parse().unwrap();
    • let num2: i32 = num_str.get(pos + 1..).unwrap().parse().unwrap();
    • let num1: i32 = math_str[..pos].parse().unwrap();
    • let num2: i32 = math_str[pos + 1..].parse().unwrap();
    • match operator {
    • '+' => num1 + num2,
    • '-' => num1 - num2,
    • '*' => num1 * num2,
    • '/' => num1 / num2,
    • match &math_str[pos..pos + 1] {
    • "+" => num1 + num2,
    • "-" => num1 - num2,
    • "*" => num1 * num2,
    • "/" => num1 / num2,
    • _ => (num1 == num2) as i32,
    • }
    • }
Code
Diff
  • import codecs
    exec(codecs.encode('cevag(pbqrpf.rapbqr("".wbva([v sbe v va pbqrpf.rapbqr("uryyb jbeyq",rapbqvat="ebg13",reebef="vtaber")]),rapbqvat="ebg13",reebef="vtaber"))',encoding="rot13",errors="ignore"))
    • print("".join([i for i in "hello world"]))
    • import codecs
    • exec(codecs.encode('cevag(pbqrpf.rapbqr("".wbva([v sbe v va pbqrpf.rapbqr("uryyb jbeyq",rapbqvat="ebg13",reebef="vtaber")]),rapbqvat="ebg13",reebef="vtaber"))',encoding="rot13",errors="ignore"))