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 will_this_work():
acc=0
for x in ((),(),()):
acc+=1
return acc
import codewars_test as test
# TODO Write tests
import solution # or from solution import example
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Example")
def test_group():
@test.it("test case")
def test_case():
test.assert_equals(1 + 1, 2)
def pennies(dollar):
return 100*dollar
import codewars_test as test
# TODO Write tests
import solution # or from solution import example
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Example")
def test_group():
@test.it("test case")
def test_case():
test.assert_equals(1 + 1, 2)
def does_this_work(arr):
i=0
while i<len(arr):
mn=i
for j in range(i+1,len(arr)):
if arr[mn]>arr[j]:
mn=j
if mn!=i:
arr[mn],arr[i]=arr[i],arr[mn]
i+=1
return arr
import codewars_test as test
# TODO Write tests
import solution # or from solution import example
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Example")
def test_group():
@test.it("test case")
def test_case():
test.assert_equals(1 + 1, 2)
test.assert_equals(sorted([1,5,10,-100,3,5,4,12,13,14]), does_this_work([1,5,10,-100,3,5,4,12,13,14]))
Consider an array/list of sheep where some sheep may be missing from their place. We need a function that counts the number of sheep present in the array (true means present).
For example,
[True, True, True, False,
True, True, True, True ,
True, False, True, False,
True, False, False, True ,
True, True, True, True ,
False, False, True, True]
The correct answer would be 17.
Hint: Don't forget to check for bad values like null/undefined
def count_sheeps(sheeps):
pass
import codewars_test as test
# TODO Write tests
import solution # or from solution import example
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Example")
def test_group():
@test.it("test case")
def test_case():
array1 = [True, True, True, False,
True, True, True, True ,
True, False, True, False,
True, False, False, True ,
True, True, True, True ,
False, False, True, True],
result = count_sheeps(array1)
test.assert_equals(array1, 17)
Нужно написать функцию, которая будет подсчитывать площади прямоугольников
На вход (пример):
[[5, 8], [4, 10], [15, 40]] -> [40, 40, 600]
Eng
You need to write a function that will count the areas of squares
Example:
[[5, 8], [4, 10], [15, 40]] -> [40, 40, 600]
def calculate_square_sums(list_squares):
pass
import codewars_test as test
# TODO Write tests
import solution # or from solution import example
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Example")
def test_group():
@test.it("test case")
def test_case():
array = [[5, 8], [4, 10], [15, 40]]
result = calculate_square_sums([[5, 8], [4, 10], [15, 40]])
test.assert_equals(result, [40, 40, 600])
don't judge
function giveItall(n){
let a = [];
let b = 'abcdefghijklmnopqrstuvwxyz'
for(let i = 0; i <= n - 1; i++){
a.push(b[i]);
}
return a;
}
console.log(giveItall(11));
// 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);
});
});
def функция(первое_число, действие, второе_число):
if действие == '+':
return первое_число + второе_число
elif действие == '-':
return первое_число - второе_число
elif действие == '*':
return первое_число * второе_число
elif действие == '/':
return первое_число / второе_число
elif действие == '**':
return первое_число ** второе_число
return 'ошибка'
import codewars_test as test
# TODO Write tests
from solution import функция
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Example")
def test_group():
@test.it("test case")
def test_case():
test.assert_equals(функция(10, '/', 5), 2)
test.assert_equals(функция(2, '*', 4), 8)
test.assert_equals(функция(101, '+', 98), 199)
test.assert_equals(функция(1000, '/', 20), 50)
test.assert_equals(функция(11, '-', 3), 8)
test.assert_equals(функция(2, '**', 6), 64)
test.assert_equals(функция(10, 'новое_действие', 11), 'ошибка')
no is in foundations of english and doesn't know how to write normal sentences.
luckily no is a prodigy in coding and knows how to make string arrays in the form of sentences
turn no's arrays into sentences
ex.
["the", "dog", "is", "brown"]
"the dog is brown"
using System;
public class Kata
{
public static string ArrayToSentence(string[] words)
{
// Your code here!!!
}
}
namespace Solution {
using NUnit.Framework;
using System;
// TODO: Replace examples and use TDD by writing your own tests
[TestFixture]
public class SolutionTest
{
[Test]
public void MyTest()
{
Assert.AreEqual("the cat ran up the hill and fell back down", Kata.ArrayToSentence(new string[]{"the", "cat", "ran", "up", "the", "hill", "and", "fell", "back", "down"}));
}
}
}
You will be given a 2d-list
which represents forest consistings of 🌲's.
A magick mushroom (🍄) will randomly generate in the forests.
Task
Return the (x,y)
coordinates of the magick mushroom in the forst. Return -1
if there are no magick mushroom.
from typing import Any
def find_the_magick_mushroom(forest: list) -> Any:
for t, tree in enumerate(forest):
for m, mushroom in enumerate(tree):
if mushroom == '🍄':
return t, m
return -1
import codewars_test as test
from solution import find_the_magick_mushroom
import random
@test.describe("Example")
def test_group():
@test.it("test case 1: find mushroom coordinates")
def test_case():
for n in range(101):
forest = [['🌲' for i in range(10)] for j in range(10)]
i = random.randint(0,9)
j = random.randint(0,9)
forest[i][j] = '🍄'
test.assert_equals(find_the_magick_mushroom(forest), (i, j))
@test.it("test case 2: No mushroom found")
def test_case():
forest = [['🌲' for i in range(10)] for j in range(10)]
test.assert_equals(find_the_magick_mushroom(forest), (-1))
kaneki's favourite kata
def ghoul(n):
result = []
while n > 0:
result.append(f"{n} - 7 = {n-7}")
n -= 7
for i in result:
print(i, end='\n')
return "I'm dead inside ghoul double S+ rang Kaneki Ken"
import codewars_test as test
from solution import ghoul
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Dead Inside")
def test_group():
@test.it("Kaneki's Test")
def test_case():
test.assert_equals(ghoul(1000), "I'm dead inside ghoul double S+ rang Kaneki Ken")