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
  • solution = lambda n: str(n).__contains__('3')
    • solution = lambda n: '3' in str(n)
    • solution = lambda n: str(n).__contains__('3')
Code
Diff
  • def forbes_route(*distance: list) -> int:
        """Find the greatest distance in km, converts to miles and return."""
        return max(*distance) // 1.6
    • def forbes_route(*distance: list) -> int:
    • """Find the greatest distance in km, converts to miles and return."""
    • return (max(*distance)) // 1.6
    • return max(*distance) // 1.6
Strings
Mathematics
Logic
Code
Diff
  • class Person:
        def __init__(self, name):
            self.name = name
            self.iq = '544957544954435894'
            self.skill_level = self.calculate()
    
        def calculate(self):
            karma = [8734]
    
            def pancakes(s):
                ht = {'0': '1', '1': '0'}
                return ''.join([ht[i] for i in s])
    
            karma += [int(pancakes(bin(int(self.iq[i:i + 2]))[2:].zfill(7)), 2) for i in range(0, len(self.iq), 2)]
            return ' '.join([chr(i) for i in karma])
    
    
    • class Person:
    • def __init__(self, name, iq=float('inf'), lua_iq = 0):
    • self.name = name
    • self.iq = iq
    • self.lua_iq = lua_iq
    • def __init__(self, name):
    • self.name = name
    • self.iq = '544957544954435894'
    • self.skill_level = self.calculate()
    • def calculate(self):
    • karma = [8734]
    • def pancakes(s):
    • ht = {'0': '1', '1': '0'}
    • return ''.join([ht[i] for i in s])
    • karma += [int(pancakes(bin(int(self.iq[i:i + 2]))[2:].zfill(7)), 2) for i in range(0, len(self.iq), 2)]
    • return ' '.join([chr(i) for i in karma])
    • you = Person('you')
    • print(you.name,'has',you.iq,'IQ!')
    • print(you.iq > you.lua_iq)
Code
Diff
  • #grade_calc = lambda s: 'FDCBAA'[max(5, int(s//10)) - 5] if 0 <= s <= 100 else 'Not a grade'
    
    grade_calc = lambda s: 'FFFFFFDCBAA'[int(s//10)] if 0 <= s <= 100 else 'Not a grade'
    • def grade_calc(score):
    • return 'Not a grade' if score not in range(101) else ["F", "F", "F", "F", "F", "F", "D", "C", "B", "A", "A"][score // 10]
    • #grade_calc = lambda s: 'FDCBAA'[max(5, int(s//10)) - 5] if 0 <= s <= 100 else 'Not a grade'
    • grade_calc = lambda s: 'FFFFFFDCBAA'[int(s//10)] if 0 <= s <= 100 else 'Not a grade'
Fundamentals
Strings

Simplified the function, but there's still room for improvement (for example, make it accept multiple types, like it is suggested by the test cases)

Code
Diff
  • std::string digest(const std::string param) {
        std::string result;
        for (char letter: param) {
          result += std::basic_string(1, letter) + " ";
        }
        result.pop_back();
        return result;
    }
    • using namespace std;
    • string digest(string param) {
    • string result;
    • for (int i = 0; i < param.size() - 1; i++) {
    • result += param[i];
    • result += ' ';
    • std::string digest(const std::string param) {
    • std::string result;
    • for (char letter: param) {
    • result += std::basic_string(1, letter) + " ";
    • }
    • result += param[param.size() - 1];
    • result.pop_back();
    • return result;
    • }