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.

### Fizz Buzz algorithm in Python

Code
Diff
• ``````def fizz_buzz(m): return ["Fizz"*(n%3==0)+"Buzz"*(n%5==0)  if (n%3==0 or n%5==0) else n for n in range(1,m)]
``````
• def fizz_buzz(m):
• return ["Fizz"*(n%3==0)+"Buzz"*(n%5==0) if (n%3==0 or n%5==0) else n for n in range(1,m)]
• def fizz_buzz(m): return ["Fizz"*(n%3==0)+"Buzz"*(n%5==0) if (n%3==0 or n%5==0) else n for n in range(1,m)]

### Get every nth word in a string

Algorithms
Logic
Code
Diff
• ``def get_nth_words(string, n): return " ".join(string.split()[n-1::n]) if n>0 else ""``
• def get_nth_words(string, n):
• return " ".join(string.split()[n-1::n]) if n>0 else ""
• def get_nth_words(string, n): return " ".join(string.split()[n-1::n]) if n>0 else ""

### Sarai vs. Kadafi - Fizzbuzz

Code
Diff
• ``````public class FizzBuzz
{
public string GetOutput(int number)
{
if (number % 3 == 0 && number % 5 == 0)
return "FizzBuzz";
if (number % 3 == 0)
return "Fizz";
if (number % 5 == 0)
return "Buzz";
return number.ToString();
}
}``````
• public class FizzBuzz
• {
• public string GetOutput(int number)
• {
• if (number % 3 == 0 && number % 5 == 0)
• {
• return "FizzBuzz";
• }
• if (number % 3 == 0)
• {
• return "Fizz";
• }
• return "Fizz";
• if (number % 5 == 0)
• {
• return "Buzz";
• }
• return number.ToString();
• }
• }
Failed Tests

### Hello Python!

Code
Diff
• ``print("Hello Rust")``
• print("Hello Python")
• print("Hello Rust")

### meaning of life

Code
Diff
• ``meaning_of_life_is=lambda:str(exec('import this'))``
• def meaning_of_life_is():
• return """
• go crazy with your imagination and return anything you like.
• strings, numbers, ... just don't return None.
• may the most creative answer win
• """
• meaning_of_life_is=lambda:str(exec('import this'))
Failed Tests

### Sarai vs. Kareona - Validate Email

Code
Diff
• ``````const parse = (value) => {
// if valid email, return true, else return false
const validCharacters = /[\w+]/ig
const result = validCharacters.exec(value).input;
if(result.includes('@') && result.includes('.') && !result.includes(' ') ){
return true;
}
else
{
return false;
}
}``````
• const parse = (value = '') => {
• // if valid email, return true, else return false
• let validEmail;
• const validCharacters = ["a","A", "b","B","c","C","d","D","e","E","f","F",
• "g","G","h","H","i","I","j","J","k","K","l","L",
• "m","M","n","N","o","O","p","P","q","Q","r","R",
• "s","S","t","T","u","U","v","V","w","W","x","X",
• "y","Y","z","Z","0","1","2","3","4","5","6","7",
• "8","9","@","."]
• const emailArray = value.split("");
• for (let i = 0; i < emailArray.length; i++) {
• if (validCharacters.includes(value[i]) == true) {
• validEmail = true;
• const parse = (value) => {
• // if valid email, return true, else return false
• const validCharacters = /[\w+]/ig
• const result = validCharacters.exec(value).input;
• if(result.includes('@') && result.includes('.') && !result.includes(' ') ){
• return true;
• }
• else {
• validEmail = false;
• break;
• else
• {
• return false;
• }
• }
• return validEmail;
• }