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 get_combination(k, n): def get_factorial(x): if x <= 0:return None if x <= 1:return 1 return x * get_factorial(x-1) if k <= 0 or n <= 0:return "n and k must be positive." if n < k: return "n must be greater than or equal to k." else: combination = get_factorial(n) / (get_factorial(n-k)*get_factorial(k)) return combination
- def get_combination(k, n):
- def get_factorial(x):
- if x <= 0:return None
- if x <= 1:return 1
- return x * get_factorial(x-1)
if k <= 0 or n <= 0:return "n and k must be positive."- if k <= 0 or n <= 0:return "n and k must be positive."
- if n < k:
- return "n must be greater than or equal to k."
- else:
- combination = get_factorial(n) / (get_factorial(n-k)*get_factorial(k))
- return combination
Considering leap years
package kata // CalcAgeOnMars calculates the age on Mars from on a age on Earth func CalcAgeOnMars(age int) int { return int(float64(age) * 365.25 / 686.97) }
- package kata
- // CalcAgeOnMars calculates the age on Mars from on a age on Earth
- func CalcAgeOnMars(age int) int {
return age * 365 / 687- return int(float64(age) * 365.25 / 686.97)
- }