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.
no need for constant since it is only used in one method. uses string formatting instead of concat
public class Greet { public String greet(String name){ return String.format("hello my name is %s", name); } }
- public class Greet {
private String GREET="hello";- public String greet(String name){
return GREET.concat(" my name is ").concat(name);- return String.format("hello my name is %s", name);
- }
- }
try to format the code properly
Correction of the algorithme
import re def count(text: str) -> int: pattern = r"[aeiouyAEIOUY]" # Find all vowel matches in the string/text matches = re.findall(pattern, text) # Return the number of vowels return len(matches)
- import re
- def count(text: str) -> int:
ctr = 0vowels = ['a', 'e', 'i', 'o', 'u']for letter in text:if letter.lower() in vowels:ctr += 1- pattern = r"[aeiouyAEIOUY]"
- # Find all vowel matches in the string/text
- matches = re.findall(pattern, text)
return ctr- # Return the number of vowels
- return len(matches)
import re import codewars_test as test from solution import count # test.assert_equals(actual, expected, [optional] message) @test.describe("Example") def test_group(): @test.it("test case") def test_case(): test.assert_equals(count('123'), 0) test.assert_equals(count('hi'), 1) test.assert_equals(count('seraph'), 2) test.assert_equals(count('codewarz'), 3) test.assert_equals(count('MissISsIpPi'), 4)
- import re
- import codewars_test as test
- from solution import count
- # test.assert_equals(actual, expected, [optional] message)
- @test.describe("Example")
- def test_group():
- @test.it("test case")
- def test_case():
- test.assert_equals(count('123'), 0)
- test.assert_equals(count('hi'), 1)
- test.assert_equals(count('seraph'), 2)
- test.assert_equals(count('codewarz'), 3)
- test.assert_equals(count('MissISsIpPi'), 4)