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.

### Табулирование функции

Code
Diff
• const tab = (f, a, b, h) => {
let sum = 0;
for (let x = a; x <= b; x +=h){
sum += f(x); //Filippov Ilya
}
return sum
}
• const tab = (f, a, b, h) => {
• let sum = 0;
• for (let x = a; x <= b; x +=h){
• sum += f(x); //Filippov Ilya
• }
• return sum
• }

### Сумма нечетных

Code
Diff
• //Крюков Кирилл
function sumNechet(a, b) {
for (var i = a; i <= b; i++){
if (i % 2 != 0){
}
}
}

console.log(sumNechet(5,15));
• //Крюков Кирилл
• function sumNechet(a, b) {
• for (var i = a; i <= b; i++){
• if (i % 2 != 0){
• }
• }
• }
• function нечетное(число) {
• }
• console.log(sumNechet(5,15));

### Зрительный зал

Code
Diff
• const cinema_auditorium = (spisok2d, ryad) => {
let totalsoldtickets = 0;

for(let i = 0; i < spisok2d.length; i++) {
for(let j = 0; j < spisok2d[i].length; j++) {
if(spisok2d[i][j] === 1 && i === ryad) {
totalsoldtickets++;
}
}
}

}
• const cinema_auditorium = (spisok2D,ryad)=> {
• return 4
• const cinema_auditorium = (spisok2d, ryad) => {
• let totalsoldtickets = 0;
• for(let i = 0; i < spisok2d.length; i++) {
• for(let j = 0; j < spisok2d[i].length; j++) {
• if(spisok2d[i][j] === 1 && i === ryad) {
• totalsoldtickets++;
• }
• }
• }
• }
Failed Tests

### cw-2.py test.expect_error(function, exception=Exception, message, parameters)

Improvements

Code
Diff
• # Effectively works with everything

def new_expect_error(function, exception=Exception, message = "{} did not raise an exception of {}", parameters = []) -> bool:
if not(isinstance(function, type(lambda:[])) and isinstance(exception, Exception) and isinstance(message, str) and isinstance(parameters, list)):
raise TypeError('parameters input problem')
try:
if parameters==[]:
function(*parameters)
else:
function()
except exception:
return True
return False
• # BaseException >> Exception
• def f1(): raise Exception()
• # Effectively works with everything
• # BaseException >> Exception >> ArithmeticError >> ZeroDivisionError
• def f2(): return 1 // 0
• # BaseException >> Exception >> LookupError >> KeyError
• def f3(): return {}[1]
• def f0(): pass
• def new_expect_error(function, exception=Exception, message = "{} did not raise an exception of {}", parameters = []) -> bool:
• if not(isinstance(function, type(lambda:[])) and isinstance(exception, Exception) and isinstance(message, str) and isinstance(parameters, list)):
• raise TypeError('parameters input problem')
• try:
• if parameters==[]:
• function(*parameters)
• else:
• function()
• except exception:
• return True
• return False

### randomAB

Code
Diff
• randomAB=(a,b)=>{
return Math.round(Math.random()*(b - a) + a)

}
• randomAB=(a,b)=>{
• return Math.round(Math.random()*(b - a) + a)
• }

### Greetings!

Code
Diff
• greeting=Greeting=lambda name,rank='',formal=False:"He{0}, {1}{2}{3}{4}".format(('y','llo')[formal],rank*formal,' '*bool(rank and formal),name,'!.'[formal])
• def Greeting(n, rank='', formal=False):
• determinant = f'{rank} {n}' if formal and rank else f'{n}'
• return f"Hello, {determinant}." if formal else f"Hey, {determinant}!"
• greeting=Greeting=lambda name,rank='',formal=False:"He{0}, {1}{2}{3}{4}".format(('y','llo')[formal],rank*formal,' '*bool(rank and formal),name,'!.'[formal])

### Identifiera Datatyp

Fundamentals
Logic
Code
Diff
• def identify_data_type(n):
return str(type(n))[8:-2]
• def identify_data_type(n):
• return n.__class__.__name__
• return str(type(n))[8:-2]

### Reverse strings but python now

Fundamentals
Strings
Code
Diff
• reverse_string = lambda s: s[::-1]
• def reverse_string(s):
• return s[::-1]
• reverse_string = lambda s: s[::-1]