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
Code
Diff
  • def feed_the_primates(animals: list, food: list) -> list:
         return 'No bananas!' if "🍌" not in food else list(map(lambda a: f"🍌{a}", filter(lambda m: m if m in ["🐒", "🦍"] else None, animals)))
    • def feed_the_primates(animals: list, food: list) -> list:
    • if "🍌" not in food: return 'No bananas!'
    • return list(map(lambda a: f"🍌{a}", filter(lambda m: m if m in ["🐒", "🦍"] else None, animals)))
    • # Solution 1: Slow
    • #if "🍌" not in food: return 'No bananas!'
    • #return [f"🍌{m}" for m in animals if m in ["🐒", "🦍"]]
    • return 'No bananas!' if "🍌" not in food else list(map(lambda a: f"🍌{a}", filter(lambda m: m if m in ["🐒", "🦍"] else None, animals)))
Code
Diff
  • def days(month,day):
        return ((y := d.date)((x := d.datetime.now().year), month, day) - y(x, 1, 1)).days + 1
    • def days(month,day):
    • return (d.date(d.datetime.now().year, month, day) - d.date(d.datetime.now().year, 1, 1)).days + 1
    • return ((y := d.date)((x := d.datetime.now().year), month, day) - y(x, 1, 1)).days + 1
Code
Diff
  • #Feel free to add some more, this is far from finished. Just a couple notes:
    #
    #Don't modify things that arn't yours without a reason.
    #
    #If you DO change someone else's, please leave a comment/note in description saying why you did so.
    #
    #P.s if you don't like the formatting, let me know.
    # ================
    # Basic search/lookup    
    # ================
    # find a word.
    word = "bacon"
    
    # Find a letter.
    letter = "[b]"
    
    # Find each of the given letters.
    list_of_letters = "[bacon]"
    
    # Find any letter NOT given.
    exclude = "[^bacon]"
    
    # Find all lowercase letters.
    lowercase = "[a-z]"
    
    # Find all uppercase letters.
    uppercase = "[A-Z]"
    
    # Find/exlude all letters.
    all_letters, no_letters = "[A-Za-z]", "[^A-Za-z]"
    
    # Find literaly anything.
    wild_card = "."
    
    # Find either A or B.
    alternate = "bacon|eggs"
    
    # Find a given character catagory.
    any_space = "\s"
    any_digit = "\d"
    any_digit_letter_or_underscore = '\w'
    
    # Find anything but a given catagory.
    no_space = "\S"
    no_digit = "\D"
    no_digit_letter_or_underscore = '\W'
    # ================
    # Grouping   
    # ================
    # Group a regex match, no name or ID.
    group = "bacon (?:and eggs)"
    
    # Group with assigned ID, starts at 1. 
    group_with_id = "bacon and (eggs)"
    
    # Group with assigned name.
    group_with_name = "(?P<food>bacon|eggs)"
    
    # Group that gets ignored.
    commented_group = "(?#mmmmm bacon is tasty)"
    
    # Using a group id - the following will match "bacon, eggs, and bacon".
    using_group_id = "(bacon), eggs, and \1"
    
    # ================
    # Quantifiers   
    # ================
    # 0 or 1 - "" or "bacon".
    zero_or_one = "(bacon)?" 
    
    # 0 or More - "" to "baconbaconbaconbacon...".
    zero_or_more = "(bacon)*"
    
    # One or More - "bacon" to "baconbaconbacon....".
    one_or_more = "(bacon)+"
    
    # An exact amount of matches - the following will match "baconbaconbacon".
    exact_number_of_matches = "(bacon){3}"
    
    # X or more matches
    x_or_more_matches = "(bacon){3,}"
    
    # Match between a specified range
    range_count_matches = "(bacon){3,100}"
    # ===============
    # String Escapes (not exclusive to regex)
    # ================
    single_quote = '\''	
    
    double_quotes = "\""
    
    back_slash = '\\'
    
    new_line = '\n'
    
    carriage_return = '\r'
    
    tab = '\t'	
    
    space = '\s'
    
    backspace = '\b'
    
    form_feed = '\f'
    
    octal = '\ooo'
    
    hex_value = '\x00'	
    
    
    • #Feel free to add some more, this is far from finished. Just a couple notes:
    • #
    • #Don't modify things that arn't yours without a reason.
    • #
    • #If you DO change someone else's, please leave a comment/note in description saying why you did so.
    • #
    • #P.s if you don't like the formatting, let me know.
    • # ================
    • # Basic search/lookup
    • # ================
    • # find a word.
    • word = "bacon"
    • # Find a letter.
    • letter = "[b]"
    • # Find each of the given letters.
    • list_of_letters = "[bacon]"
    • # Find any letter NOT given.
    • exclude = "[^bacon]"
    • # Find all lowercase letters.
    • lowercase = "[a-z]"
    • # Find all uppercase letters.
    • uppercase = "[A-Z]"
    • # Find/exlude all letters.
    • all_letters, no_letters = "[A-Za-z]", "[^A-Za-z]"
    • # Find literaly anything.
    • wild_card = "."
    • # Find either A or B.
    • alternate = "bacon|eggs"
    • # Find a given character catagory.
    • any_space = "\s"
    • any_digit = "\d"
    • any_digit_letter_or_underscore = '\w'
    • # Find anything but a given catagory.
    • no_space = "\S"
    • no_digit = "\D"
    • no_digit_letter_or_underscore = '\W'
    • # ================
    • # Grouping
    • # ================
    • # Group a regex match, no name or ID.
    • group = "bacon (?:and eggs)"
    • # Group with assigned ID, starts at 1.
    • group_with_id = "bacon and (eggs)"
    • # Group with assigned name.
    • group_with_name = "(?P<food>bacon|eggs)"
    • # Group that gets ignored.
    • commented_group = "(?#mmmmm bacon is tasty)"
    • # Using a group id - the following will match "bacon, eggs, and bacon".
    • using_group_id = "(bacon), eggs, and \1"
    • # ================
    • # Quantifiers
    • # ================
    • # 0 or 1 - "" or "bacon".
    • zero_or_one = "(bacon)?"
    • # 0 or More - "" to "baconbaconbaconbacon...".
    • zero_or_more = "(bacon)*"
    • # One or More - "bacon" to "baconbaconbacon....".
    • one_or_more = "(bacon)+"
    • # An exact amount of matches - the following will match "baconbaconbacon".
    • exact_number_of_matches = "(bacon){3}"
    • # X or more matches
    • x_or_more_matches = "(bacon){3,}"
    • # Match between a specified range
    • range_count_matches = "(bacon){3,100}"
    • # ===============
    • # String Escapes (not exclusive to regex)
    • # ================
    • single_quote = '\''
    • double_quotes = "\""
    • back_slash = '\\'
    • new_line = '\n'
    • carriage_return = '\r'
    • tab = '\t'
    • space = '\s'
    • backspace = '\b'
    • form_feed = '\f'
    • octal = '\ooo'
    • hex_value = '\x00'