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
Ad
Code
Diff
  • import statistics
    
    def est_height(gender, dad_height, mom_height):
        avg = statistics.mean([dad_height, mom_height])
        
        return avg + 0.5 if gender is "boy" else avg - 0.5
    • import statistics
    • def est_height(gender, dad_height, mom_height):
    • if gender is "boy":
    • return statistics.mean([dad_height, mom_height]) + 0.5
    • elif gender is "girl":
    • return statistics.mean([dad_height, mom_height]) - 0.5
    • avg = statistics.mean([dad_height, mom_height])
    • return avg + 0.5 if gender is "boy" else avg - 0.5

i just setted up a Alias for a native function that solves the problem

Code
Diff
  • // solved in tests
    • function caps($c) {return ucwords($c);}
    • // solved in tests

use const or let keyword before variable name;

Code
Diff
  • /*def hello_world(world):
        if world == True:
            return "Hello World baby"
        elif world == False:
            return "No World"*/
    
    // helloWorld = (world) => world == true ? 'Hello World baby': 'No World';
    
    const helloWorld=(world)=>world==true?`Hello World baby`:`No World`;
    • /*def hello_world(world):
    • if world == True:
    • return "Hello World baby"
    • elif world == False:
    • return "No World"*/
    • // helloWorld = (world) => world == true ? 'Hello World baby': 'No World';
    • helloWorld
    • =(_)=>
    • _?`Hello World baby`:`No World`
    • const helloWorld=(world)=>world==true?`Hello World baby`:`No World`;
Test Cases
Diff
  • import codewars_test as test
    # TODO Write tests
    from solution import multiply
    
    # test.assert_equals(actual, expected, [optional] message)
    @test.describe("Example")
    def test_group():
        @test.it("test case")
        def test_case():
            test.assert_equals(multiply(2, 4), 8)
    from operator import mul as multiply
    • import codewars_test as test
    • # TODO Write tests
    • from solution import multiply
    • # test.assert_equals(actual, expected, [optional] message)
    • @test.describe("Example")
    • def test_group():
    • @test.it("test case")
    • def test_case():
    • test.assert_equals(multiply(2, 4), 8)
    • from operator import mul as multiply
Code
Diff
  • const cinema_auditorium = (spisok2D,ryad) => spisok2D[ryad].reduce((sum, el)=> sum+el);
    • const cinema_auditorium = (spisok2D,ryad)=> {
    • return spisok2D[ryad].reduce((sum, el)=> sum+el)
    • }
    • const cinema_auditorium = (spisok2D,ryad) => spisok2D[ryad].reduce((sum, el)=> sum+el);