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.

### Add the missing Product function for python

Code
Diff
• ``prod_=lambda _:__import__('math').prod(_)*bool(_)``
• from math import prod
• def prod_(arr):
• return prod(arr) if arr else 2 + 2 == 5
• prod_=lambda _:__import__('math').prod(_)*bool(_)

### num to str

Code
Diff
• ``````def converter(n):
return dict(enumerate(("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"))).get(n)
``````
• def converter(number):
• try:
• return ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"][number]
• except IndexError:
• return None
• def converter(n):
• return dict(enumerate(("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"))).get(n)

### Reverse a string

Code
Diff
• ``const revstr = str => str.split("").reverse().join("")``
• const revstr = str => str.split``.reverse().join``
• const revstr = str => str.split("").reverse().join("")

### Integer to table

Tables
Data Structures
Code
Diff
• ``````def int_to_table(num):
return [number for number in range(num+ 1)]

``````
• def int_to_table(num):
• return list(range(0,num+1))
• return [number for number in range(num+ 1)]

### Find Max - Kareona vs. Phoenix

Code
Diff
• ``````import java.util.Arrays;
import java.util.Collections;

public class Kata
{
public static int findMax(int[] my_array)
{
int max = 0;
for(int i = 0; i < my_array.length; i++)
{
if(my_array[i] > max)
{
max = my_array[i];
}
}
return max;
}
}``````
• import java.util.Arrays;
• import java.util.Collections;
• public class Kata {
• public static int findMax(int[] my_array) {
• // Write a method that returns the largest integer in the list.
• // You can assume that the list has at least one element.
• // without using ready implementation
• return Arrays.stream(my_array)
• .reduce(my_array[0], (acc, elem) -> acc > elem ? acc : elem);
• public class Kata
• {
• public static int findMax(int[] my_array)
• {
• int max = 0;
• for(int i = 0; i < my_array.length; i++)
• {
• if(my_array[i] > max)
• {
• max = my_array[i];
• }
• }
• return max;
• }
• }

### Sarai vs. Kadafi - Fizzbuzz

Code
Diff
• ``````public class FizzBuzz
{
public string GetOutput(int number) => number % 15 == 0? "FizzBuzz":number%3 == 0?"Fizz":number%5==0?"Buzz":number.ToString();
}``````
• public class FizzBuzz
• {
• public string GetOutput(int number) {
• if (number % 15 == 0) return "FizzBuzz";
• else if (number % 3 == 0) return "Fizz";
• else if (number % 5 == 0) return "Buzz";
• else return number.ToString();
• // Fizz buzz is a popular computer science interview question.
• // The function above is given a number - if the number is
• // divisible by 3, return "fizz", if it's divisible by 5,
• // return "buzz", if not divisble by 3 or 5 - return the
• // number itself.
• }
• public string GetOutput(int number) => number % 15 == 0? "FizzBuzz":number%3 == 0?"Fizz":number%5==0?"Buzz":number.ToString();
• }

### Ulysses vs. Terrence - Remove every Third Character

Code
Diff
• ``removeEveryThird=s=>s[0]+s.slice(1).replace(/(..)./g,'\$1')``
• function removeEveryThird(str) {
• return (str[0] || '') + str
• .slice(1)
• .replace(/(..)./g, '\$1')
• }
• removeEveryThird=s=>s[0]+s.slice(1).replace(/(..)./g,'\$1')

### Decimal numbers to Roman numerals (With Value Protection and typing hints!)

Basic Language Features
Fundamentals
Control Flow
Code
Diff
• ``````def convert_decimal_roman(number: int) -> str:
try:
number = int(number)
if number<1 or number >=4000:
print("Range Error: Number can only be between 1 and 3999.")
return("Invalid Input")
except ValueError:
print("Invalid Input, Value Error")
return("Invalid Input")
str = ''
numDct = {1000: "M",
900: "CM",
500: "D",
400: "CD",
100: "C",
90: "XC",
50: "L",
40: "XL",
10: "X",
9: "IX",
5: "V",
4: "IV",
1: "I"}

decimals = []
for key, value in numDct.items():
decimals.append(value * (number // key))
number %= key

return "".join(decimals)``````
• def convert_decimal_roman(number: int) -> str:
• try:
• number = int(number)
• if number<1 or number >=4000:
• print("Range Error: Number can only be between 1 and 3999.")
• return("Invalid Input")
• except ValueError:
• print("Invalid Input, Value Error")
• return("Invalid Input")
• str = ''
• numDct = {1000: "M",
• 900: "CM",
• 500: "D",
• 400: "CD",
• 100: "C",
• 90: "XC",
• 50: "L",
• 40: "XL",
• 10: "X",
• 9: "IX",
• 5: "V",
• 4: "IV",
• 1: "I"}
• decimals = []
• for key, value in numDct.items():
• decimals.append(value * (number // key))
• number %= key
• return "".join(decimals)