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.
def find_multiples_of_4_and_6(n): for i in range(n): if not (i % 4 and i % 6): yield i
find_multiples_of_4_and_6 = lambda n : [i for i in range(n) if not (i % 4 and i % 6)]- def find_multiples_of_4_and_6(n):
- for i in range(n):
- if not (i % 4 and i % 6):
- yield i
import codewars_test as test import solution # or from solution import example @test.describe("Example") def test_group(): @test.it("test case") def test_case(): test.assert_equals(list(find_multiples_of_4_and_6(20)), [0, 4, 6, 8, 12, 16, 18]) test.assert_equals(list(find_multiples_of_4_and_6(35)), [0, 4, 6, 8, 12, 16, 18, 20, 24, 28, 30, 32]) test.assert_equals(list(find_multiples_of_4_and_6(120)), [0, 4, 6, 8, 12, 16, 18, 20, 24, 28, 30, 32, 36, 40, 42, 44, 48, 52, 54, 56, 60, 64, 66, 68, 72, 76, 78, 80, 84, 88, 90, 92, 96, 100, 102, 104, 108, 112, 114, 116])
- import codewars_test as test
- import solution # or from solution import example
- @test.describe("Example")
- def test_group():
- @test.it("test case")
- def test_case():
test.assert_equals(find_multiples_of_4_and_6(20), [0, 4, 6, 8, 12, 16, 18])test.assert_equals(find_multiples_of_4_and_6(35), [0, 4, 6, 8, 12, 16, 18, 20, 24, 28, 30, 32])test.assert_equals(find_multiples_of_4_and_6(120), [0, 4, 6, 8, 12, 16, 18, 20, 24, 28, 30, 32, 36, 40, 42, 44, 48, 52, 54, 56, 60, 64, 66, 68, 72, 76, 78, 80, 84, 88, 90, 92, 96, 100, 102, 104, 108, 112, 114, 116])- test.assert_equals(list(find_multiples_of_4_and_6(20)), [0, 4, 6, 8, 12, 16, 18])
- test.assert_equals(list(find_multiples_of_4_and_6(35)), [0, 4, 6, 8, 12, 16, 18, 20, 24, 28, 30, 32])
- test.assert_equals(list(find_multiples_of_4_and_6(120)), [0, 4, 6, 8, 12, 16, 18, 20, 24, 28, 30, 32, 36, 40, 42, 44, 48, 52, 54, 56, 60, 64, 66, 68, 72, 76, 78, 80, 84, 88, 90, 92, 96, 100, 102, 104, 108, 112, 114, 116])
Added some test cases.
isEven = num => Number.isInteger(num) ? !(num & 1) : undefined;
isEven = _0x55bac8 => !(_0x55bac8 % 2);- isEven = num => Number.isInteger(num) ? !(num & 1) : undefined;
const expect = require("chai").expect; describe("Solution", function() { it("should be true for 4", function() { expect(isEven(4)).to.equal(true); }); it("should be false for 1", function() { expect(isEven(1)).to.equal(false); }); it("should be undefined for 1.5", function() { expect(isEven(1.5)).to.equal(undefined); }); it("should be undefined for NaN", function() { expect(isEven(NaN)).to.equal(undefined); }); it("should be undefined for Infinity", function() { expect(isEven(Infinity)).to.equal(undefined); }); it("should be undefined for -Infinity", function() { expect(isEven(NaN)).to.equal(undefined); }); it("should be undefined for undefined", function() { expect(isEven(undefined)).to.equal(undefined); }); });
- const expect = require("chai").expect;
- describe("Solution", function() {
- it("should be true for 4", function() {
- expect(isEven(4)).to.equal(true);
- });
- it("should be false for 1", function() {
- expect(isEven(1)).to.equal(false);
- });
- it("should be undefined for 1.5", function() {
- expect(isEven(1.5)).to.equal(undefined);
- });
- it("should be undefined for NaN", function() {
- expect(isEven(NaN)).to.equal(undefined);
- });
- it("should be undefined for Infinity", function() {
- expect(isEven(Infinity)).to.equal(undefined);
- });
- it("should be undefined for -Infinity", function() {
- expect(isEven(NaN)).to.equal(undefined);
- });
- it("should be undefined for undefined", function() {
- expect(isEven(undefined)).to.equal(undefined);
- });
- });
def sort(s): return "".join(sorted([i for i in s if i.isupper()])) + "".join(sorted([i for i in s if i.islower()])) + "".join(sorted([i for i in s if i.isdigit()]))
- def sort(s):
from string import ascii_lowercase, ascii_uppercasealphabet = list(ascii_uppercase) + list(ascii_lowercase) + list("0123456789")out = ""for letter in alphabet:for char in s:if char == letter:out += charreturn out- return "".join(sorted([i for i in s if i.isupper()])) + "".join(sorted([i for i in s if i.islower()])) + "".join(sorted([i for i in s if i.isdigit()]))
function greetings(){ let name = "seraph776"; return `My name is: ${name}`; }
var myName = 'Elijah'console.log(`My name is: ${myName}`)- function greetings(){
- let name = "seraph776";
- return `My name is: ${name}`;
- }
const chai = require("chai"); const assert = chai.assert; describe("greetings", function() { it("test1", function() { assert.strictEqual(greetings(), "My name is: seraph776"); }); });
// Since Node 10, we're using Mocha.// You can use `chai` for assertions.- const chai = require("chai");
- const assert = chai.assert;
// Uncomment the following line to disable truncating failure messages for deep equals, do:// chai.config.truncateThreshold = 0;// Since Node 12, we no longer include assertions from our deprecated custom test framework by default.// Uncomment the following to use the old assertions:// const Test = require("@codewars/test-compat");describe("Solution", function() {it("should test for something", function() {// Test.assertEquals(1 + 1, 2);// assert.strictEqual(1 + 1, 2);- describe("greetings", function() {
- it("test1", function() {
- assert.strictEqual(greetings(), "My name is: seraph776");
- });
- });
const evenOrOdd = (number = prompt("Enter a number: ")) => `The number is ${number & 1 ? "even" : "odd"}.`;
const evenOrOdd = (number = prompt("Enter a number: ")) => `The number is ${number % 2 ? "even" : "odd"}.`;- const evenOrOdd = (number = prompt("Enter a number: ")) => `The number is ${number & 1 ? "even" : "odd"}.`;