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.
package kata func Multiple3And5(number int) int { sum := 0 for i := 3; i < number; i++ { if i%15 == 0 { sum += i continue } if i%3 == 0 { sum += i } if i%5 == 0 { sum += i } } return sum }
- package kata
- func Multiple3And5(number int) int {
- sum := 0
- for i := 3; i < number; i++ {
- if i%15 == 0 {
- sum += i
- continue
- }
- if i%3 == 0 {
- sum += i
- }
- if i%5 == 0 {
- sum += i
- }
- }
- return sum
- }
No need to "branch to boolean". You can just return the condition.
You can also add " " to the list of characters to remove (which was just punctuation before) instaead of having a separate call to replace.
import string def is_palindrome(s: str) -> bool: forward = s.lower().translate(str.maketrans('', '', string.punctuation + ' ')) return forward == forward[::-1]
- import string
- def is_palindrome(s: str) -> bool:
forward = s.lower().replace(" ", "").translate(str.maketrans('', '', string.punctuation))reverse = forward[::-1]if forward == reverse:return Trueelse:return False- forward = s.lower().translate(str.maketrans('', '', string.punctuation + ' '))
- return forward == forward[::-1]
int doubleValue(int x) { return x*2; }
- int doubleValue(int x) {
return x<<1;}- return x*2;
- }
Describe(double_value) { It(first_test) { Assert::That(doubleValue(5), Equals(10)); Assert::That(doubleValue(7), Equals(14)); } It(second_test) { Assert::That(doubleValue(1000000), Equals(2000000)); Assert::That(doubleValue(-6), Equals(-12)); Assert::That(doubleValue(-108601284), Equals(-217202568)); } };
// TODO: Replace examples and use TDD by writing your own testsDescribe(sampleTests) {It(shouldBe) {Assert::That(doubleValue(5), Equals(10));Assert::That(doubleValue(6), Equals(12));Assert::That(doubleValue(7), Equals(14));Assert::That(doubleValue(8), Equals(16));- Describe(double_value) {
- It(first_test) {
- Assert::That(doubleValue(5), Equals(10));
- Assert::That(doubleValue(7), Equals(14));
- }
- It(second_test) {
- Assert::That(doubleValue(1000000), Equals(2000000));
- Assert::That(doubleValue(-6), Equals(-12));
- Assert::That(doubleValue(-108601284), Equals(-217202568));
- }
- };
Uglifyed it to it's limit. But I like it.
pyramid_of_x=lambda n:['\n'.join(['*'*(i+1) for i in range(n)]),'Not enough building blocks!'][n<2]
def pyramid_of_x(n):if n < 2:return 'Not enough building blocks!'rows = ['*' * i for i in range(1, n + 1)]return '\n'.join(rows)- pyramid_of_x=lambda n:['\n'.join(['*'*(i+1) for i in range(n)]),'Not enough building blocks!'][n<2]
const addArr
select city_name, sum(confirmed_cases) confirmed_cases , sum(recovered_cases) recovered_cases, sum(death_cases) death_cases from cases join dati on dati.code = cases.dati_code group by city_name order by confirmed_cases desc;
-- Code Here- select
- city_name,
- sum(confirmed_cases) confirmed_cases ,
- sum(recovered_cases) recovered_cases,
- sum(death_cases) death_cases
- from cases
- join dati
- on dati.code = cases.dati_code
- group by city_name
- order by confirmed_cases desc;