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.

Ad

Create a function that takes a string and returns the number of vowels in that string.

function vowels(str) {
  //code here
  }

Where is waldo?

console.log("Waldo");

• ConvertToInt


You will receive a text in which you need to convert to an int.


Input example: "105"


Output example: 105


All input will be valid numbers.

• TransformMinusIntoPlus


You will receive a text in which contains a single minus which needs to be replaced by a plus.


Input example: "111-333"


Output example: "111+333"

• ConvertToDouble


You will receive a text in which you need to convert to a double.


Input example: "15,2"


Output example: 15.2


All input will be numbers with either separator: , or .

• ReturnNumbersAsArray


You will receive a string with numbers which you will need to convert to an array of int.


Input example: "10 20 30 40 50"


Output Example: [10, 20, 30, 40, 50]


The input will always be valid numbers.

• ReturnNumbersAsString


You will receive an int array with numbers which you will need to convert to a single
string following the output example


Input example: [10, 20, 30, 40, 50]


Output Example: "10, 20, 30, 40, 50"

• RemoveDecimalPlace


You will be given a decimal number which you must remove the decimal places


Input example: 10.2


Output example: 10

• EquationResult


You will be given a text wich contains a equation with 2 numbers and one operator: + - * /


You should return the result of the equation


Input example: "10 + 2"


Output example: 12


All input will be valid equations.


If a division by zero would occur, you should return the constant double.NaN

public class Basic1
{  
    public static int ConvertToInt(string numberAsText)
    {
        return 0;
    }
  
    public static string TransformMinusIntoPlus(string text)
    {
        return "";
    }
  
    public static double ConvertToDouble(string numberAsText)
    {
        return 0;
    }
  
    public static int[] ReturnNumbersAsArray(string text) 
    {
        return null;
    } 
  
    public static string ReturnNumbersAsString(int [] numbers) 
    {
        return "";
    }            
  
    public static decimal RemoveDecimalPlace(decimal number)
    {        
        return 0;
    }
  
    public static double EquationResult(string equation) 
    {
        return 0;             
    }
}

I had trouble with the kata sum of a sequence, hard-core version. After looking at the solutions, I saw that the solutions used were more mathematical/ formula based rather than computation based.
I was hoping some of you can help make my, rather simplistic, code prettier without losing efficiency.

def sequence_sum(b, e, s):
    sum = 0
    if s >= 0:
        while b <= e:
            sum += b
            b += s
    else:
        while b > e:
            sum += b
            b += s
    return sum

Practicing if else statements

using System;

public class Kumite
{
  public bool MoreThan14(int num) {
    // Create an integer variable with the value 14
    
    // return true if your variable is bigger than num

  }
    
  // If the food is nasi lemak, return meal
  // If the food is burger, return meal
  // If the food is cendol or ice cream, return dessert
  public string MealOrDessert(string food) {
    return;
  }
}
using System;

public class Kumite
{
  public void BasicVariables(int v) {
    int count = 0;
    // Write the name of the variable to the log
    Console.WriteLine("<change this>");
    // Write the type of the variable to the log
    Console.WriteLine("<change this>");
    // set the value of the variable to v (see the function parameters)
    // <code here>
    // Write the variable to the log
    // <code here>
  }
  
  public string NamaeWa(string str) {
    // Return "My name is <str>"
    return "<change this>";
  }

}
using System;

public class Kumite
{
  public void PrintAnArray(string [] words) {
    // Write all the words to the console

  }

  public int SumTheIntegers(int [] nums) {
    // Add up all the integers and return the sum
  }
}

• ConvertTextToLong


You will receive a text which you need to convert to a long.


Input example: "105"


Output example: 105


All input will be valid numbers

• ConvertTextToDecimal


You will receive a text which you need to convert to a decimal


Input example: "30.7"


Output example: 30.7


All input will be valid numbers

• ConvertIntToLong


You will receive long which you need to convert to an int


Input example: 57


Output example: 57

• ToUpperCaseArray


You need to return a string array, upper casing every world


Input example: "hello world"


Output Example: ["HELLO", "WORLD"]


All text will contain a single space.
Spaces can occur in the begining or ending of the string

• ToLowerCaseString


Lower case every word in the given aray and return a string with all words separated by a single space.


Remove the spaces that can occur in the beginning or ending of a word.


Input example: ["HELLO", "WORLD"]


Output Example: "hello world"


All text will contain a single space.

• IsUpperCase


Based on a given text, you should:


Return 1 if all letters are upper case.


Return 0 if at least one letter is lower case


Return -1 if the text is either null, empty or only white spaces


Input example: "HELLO"


Output Example: 1

• RemoveUnnecessarySpaces


You need to remove all unecessary spaces from the given text


Including spaces in the beginning and ending of the text


Double or more spaces between the words


Input example: " Hello world "


Output Example: "Hello world"

public class Basic
{  
    public static long ConvertTextToLong(string numberAsText)
    {
        return 0;
    }
  
    public static decimal ConvertTextToDecimal(string numberAsText)
    {
        return 0;
    }
  
    public static long ConvertIntToLong(int number)
    {
        return 0;
    }  
    
    public static string[] ToUpperCaseArray(string text) 
    {
        return null;
    }
  
    public static string ToLowerCaseString(string[] words) 
    {        
        return null;
    }
  
    public static int IsUpperCase(string text)
    {
        return 0;
    }
  
    public static string RemoveUnnecessarySpaces(string text) 
    {
        return null;
    }
}
namespace Solution 
{
  using NUnit.Framework;
  using System;
  
  [TestFixture]
  public class SolutionTest
  {
      [Test]
      public void TestConvertTextToLong()
      {
          Assert.AreEqual(1L, Basic.ConvertTextToLong("1"));
          Assert.AreEqual(-1L, Basic.ConvertTextToLong("-1"));
          Assert.AreEqual(99L, Basic.ConvertTextToLong("99"));
          Assert.AreEqual(2L, Basic.ConvertTextToLong("02"));
          Assert.AreEqual(7L, Basic.ConvertTextToLong("007"));      
          Assert.AreEqual(long.MaxValue, Basic.ConvertTextToLong("" + long.MaxValue));
      }
    
      [Test]
      public void TestConvertTextToDecimal()
      {
          Assert.AreEqual(1m, Basic.ConvertTextToDecimal("1"));
          Assert.AreEqual(-1m, Basic.ConvertTextToDecimal("-1"));
          Assert.AreEqual(99m, Basic.ConvertTextToDecimal("99"));
          Assert.AreEqual(2m, Basic.ConvertTextToDecimal("02"));
          Assert.AreEqual(7m, Basic.ConvertTextToDecimal("007"));      
          Assert.AreEqual(decimal.MaxValue, Basic.ConvertTextToDecimal("" + decimal.MaxValue));
      }
    
      [Test]
      public void TestConvertIntToLong()
      {
          Assert.AreEqual(1L, Basic.ConvertIntToLong(1));
          Assert.AreEqual(-99L, Basic.ConvertIntToLong(-99));
          Assert.AreEqual(0L, Basic.ConvertIntToLong(0));
          Assert.AreEqual(3215487L, Basic.ConvertIntToLong(3215487));
          Assert.AreEqual(-3215487L, Basic.ConvertIntToLong(-3215487));
          Assert.AreEqual(int.MaxValue, Basic.ConvertIntToLong(int.MaxValue));
      }
        
      [Test]
      public void TestToUpperCaseArray()
      {          
          Assert.AreEqual(new string[] {"HELLO", "WORLD"}, Basic.ToUpperCaseArray("HELLO WORLD"));
          Assert.AreEqual(new string[] {"HELLO", "WORLD"}, Basic.ToUpperCaseArray("hello World"));
          Assert.AreEqual(new string[] {"HELLO", "WORLD"}, Basic.ToUpperCaseArray(" hello World "));
          Assert.AreEqual(new string[] {"TIME", "IS", "MONEY", "FRIEND"}, Basic.ToUpperCaseArray("TIME is money frIENd"));
          Assert.AreEqual(new string[] {"THE", "APPLE", "IS", "VERY", "JUICE"}, Basic.ToUpperCaseArray("the apple is very juice"));
          Assert.AreEqual(new string[] {"A", "B", "1", "2", "C"}, Basic.ToUpperCaseArray(" A b 1 2 c"));
          Assert.AreEqual(new string[] {"AB12C"}, Basic.ToUpperCaseArray("Ab12c"));
          Assert.AreEqual(new string[] {""}, Basic.ToUpperCaseArray(" "));
      }
    
      [Test]
      public void TestToLowerCaseString()
      {          
          Assert.AreEqual("hello world", Basic.ToLowerCaseString(new string[] {"hello", "world"}));
          Assert.AreEqual("hello world", Basic.ToLowerCaseString(new string[] {"HELLO", "WORLD"}));
          Assert.AreEqual("", Basic.ToLowerCaseString(new string[] {}));
          Assert.AreEqual("the apple is very juice", Basic.ToLowerCaseString(new string[] {"The", "Apple", "IS", "VERY", "juice"}));
          Assert.AreEqual("a b c d e f g h i j k", Basic.ToLowerCaseString(new string[] {"A", "b", "C", "D", "E", "f", "G", "h", "i", "j", "K"}));
          
      }
    
      [Test]
      public void TestIsUpperCase()
      {          
          Assert.AreEqual(1, Basic.IsUpperCase("HELLO"));
          Assert.AreEqual(1, Basic.IsUpperCase(" HELLO "));
          Assert.AreEqual(1, Basic.IsUpperCase(" HELLO  WORLD "));
          Assert.AreEqual(0, Basic.IsUpperCase("hello"));
          Assert.AreEqual(0, Basic.IsUpperCase("HeLLo"));
          Assert.AreEqual(0, Basic.IsUpperCase(" HeLLo "));
          Assert.AreEqual(0, Basic.IsUpperCase(" HELLO  wORLD "));
          Assert.AreEqual(0, Basic.IsUpperCase(" Hello  wOrLD    "));
          Assert.AreEqual(-1, Basic.IsUpperCase(" "));
          Assert.AreEqual(-1, Basic.IsUpperCase("     "));
          Assert.AreEqual(-1, Basic.IsUpperCase(""));
          Assert.AreEqual(-1, Basic.IsUpperCase(string.Empty));
          Assert.AreEqual(-1, Basic.IsUpperCase(null));
      }
    
      [Test]
      public void TestRemoveUnnecessarySpaces()
      {
          Assert.AreEqual("Hello world", Basic.RemoveUnnecessarySpaces("Hello  world"));
          Assert.AreEqual("Hello world", Basic.RemoveUnnecessarySpaces("   Hello  world"));
          Assert.AreEqual("Hello world", Basic.RemoveUnnecessarySpaces("Hello  world "));
          Assert.AreEqual("Hello world", Basic.RemoveUnnecessarySpaces(" Hello   world"));
          Assert.AreEqual("Hello world", Basic.RemoveUnnecessarySpaces(" Hello world "));
          Assert.AreEqual("Hello world", Basic.RemoveUnnecessarySpaces("     Hello   world    "));
          Assert.AreEqual("the apple is very juice", Basic.RemoveUnnecessarySpaces("  the  apple  is   very juice        "));
          Assert.AreEqual("", Basic.RemoveUnnecessarySpaces(" "));
          Assert.AreEqual("", Basic.RemoveUnnecessarySpaces("        "));
      }      
  }
}
function promedi(n1,n2,n3,n4){
  var prom=(n1,n2,n3,n4 (4/4))
  return(prom)
  
}
// 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);
  });
});

• ToLowerCaseArray


You need to return a string array, lowering the case of every world.


Remove the spaces that can occur in the beginning or ending of a word.


Input example: "HELLO WORLD"


Output Example: ["hello", "world"]


All text will contain a single space as separator

• ToUpperCaseString


Upper case every word in the aray and return a string with the words separated by a single space.


Remove the spaces that can occur in the beginning or ending of a word.


Input example: ["HELLO", "WORLD"]


Output Example: "hello world"

• RemoveUnnecessarySpaces


You need to remove all unecessary spaces from the given text


Including spaces in the beginning and ending of the text


Double or more spaces between the words


Input example: " Hello world "


Output Example: "Hello world"

• GetTheFirstLetter


Return the first letter of the given word


Input example: " Hello"


Output Example: "H"

• UpperCaseFirstLetter


You should transform the given text so the first letter is upper case and the other are lower case.


Remove the spaces that can occur in the beginning or ending of a word.


Input example: "hello"


Output Example: "Hello"

• ToCamelCase


You need to remove every space and also upper case the first letter of every world


Input example: "the apple is very juice "


Output Example: "TheAppleIsVeryJuice"


Spaces can occur multiple time including in the begining and ending

public class Basic
{
    public static string[] ToLowerCaseArray(string text) 
    {        
        return null;
    }
  
    public static string ToUpperCaseString(string[] words) 
    {        
        return null;
    }
  
    public static string RemoveUnnecessarySpaces(string text) 
    {
        return null;
    }
  
    public static string GetTheFirstLetter(string text) 
    {
        return null;
    }
  
    public static string UpperCaseFirstLetter(string text) 
    {
        return null;          
    }
  
    public static string ToCamelCase(string text) 
    {
        return null;
    }
}