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.
Description
Create a function that accepts a string s
and returns the sum
of the ASCII values of each character in the given string.
using System; using System.Linq; namespace Solution { public static class ToAscii { public static int GetAsciiSum(string s) => s.Select(character => (int)character).Sum(); } }
- using System;
namespace Solution{public class ToAsci{public static int getAsciSum(string s){int returner = 0;foreach (var el in s)returner += (int)el;return returner;}}- using System.Linq;
- namespace Solution
- {
- public static class ToAscii
- {
- public static int GetAsciiSum(string s) => s.Select(character => (int)character).Sum();
- }
- }
using System; using NUnit.Framework; namespace Solution { // TODO: Replace examples and use TDD development by writing your own tests [TestFixture] public class SolutionTest { [Test] public void MyTest() { Assert.AreEqual(0, ToAscii.GetAsciiSum("")); Assert.AreEqual(97, ToAscii.GetAsciiSum("a")); Assert.AreEqual(448, ToAscii.GetAsciiSum("test")); Assert.AreEqual(2286, ToAscii.GetAsciiSum("Some Words and numbers 453")); Assert.AreEqual(730, ToAscii.GetAsciiSum("&@Sp15, R@m")); } } }
namespace Solution {using NUnit.Framework;using System;- using System;
- using NUnit.Framework;
// TODO: Replace examples and use TDD development by writing your own tests- namespace Solution
- {
- // TODO: Replace examples and use TDD development by writing your own tests
[TestFixture]public class SolutionTest{[Test]public void MyTest()- [TestFixture]
- public class SolutionTest
- {
Assert.AreEqual(448, ToAsci.getAsciSum("test"));Assert.AreEqual(97, ToAsci.getAsciSum("a"));Assert.AreEqual(2286, ToAsci.getAsciSum("Some Words and numbers 453"));Assert.AreEqual(730, ToAsci.getAsciSum("&@Sp15, R@m"));- [Test]
- public void MyTest()
- {
- Assert.AreEqual(0, ToAscii.GetAsciiSum(""));
- Assert.AreEqual(97, ToAscii.GetAsciiSum("a"));
- Assert.AreEqual(448, ToAscii.GetAsciiSum("test"));
- Assert.AreEqual(2286, ToAscii.GetAsciiSum("Some Words and numbers 453"));
- Assert.AreEqual(730, ToAscii.GetAsciiSum("&@Sp15, R@m"));
- }
- }
}- }
from math import sqrt def primemaker(x): primes = [] if x < 2: return [] else: primes.append(2) for possible_prime in range(3,(x+1), 2): # only odd numbers limit = sqrt(possible_prime) for prime in primes: if prime > limit: primes.append(possible_prime) break if 0 == possible_prime % prime: break return primes
- from math import sqrt
- def primemaker(x):
- primes = []
- if x < 2:
- return []
- else:
- primes.append(2)
- for possible_prime in range(3,(x+1), 2): # only odd numbers
- limit = sqrt(possible_prime)
is_prime = True- for prime in primes:
- if prime > limit:
- primes.append(possible_prime)
- break
- if 0 == possible_prime % prime:
is_prime = False- break
if is_prime:primes.append(possible_prime)- return primes
from collections import Counter def FindOnly(values): items = Counter(values) for item in items: if items[item] == 1: return item
- from collections import Counter
- def FindOnly(values):
for value in set(values):if 1 == values.count(value): # check value is uniquereturn value- items = Counter(values)
- for item in items:
- if items[item] == 1:
- return item
function fizzBuzz(num) { for (let i=1;i <= num; i++) { if (i%3===0) {console.log("fizz");}; if (i%5===0) {console.log("buzz");} if (i%15===0) {console.log("fizzbuzz");} } }; fizzBuzz(15); //
- function fizzBuzz(num) {
for (let i=1;i <= (num); i++) {let fb = '';if (i%3===0) {fb = fb + 'fizz'};if (i%5===0) {fb = fb + 'buzz'};if (fb==='') { console.log(i); } else { console.log(fb); };- for (let i=1;i <= num; i++) {
- if (i%3===0) {console.log("fizz");};
- if (i%5===0) {console.log("buzz");}
- if (i%15===0) {console.log("fizzbuzz");}
- }
- };
- fizzBuzz(15); //