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

We can say hello, AND we can count!

Code
Diff
  • print("Hello from ") print(_VERSION)
    
    print("We can count to 3! Are you ready?")
    for i=1,3 do
     print(i..string.rep("!",i))
    end
    print("We're so good at counting!")
    
    kata = {}
    function kata.foo()
      return "expected"
    end
    return kata
    • print("Hello from ") print(_VERSION)
    • print("We can count to 3! Are you ready?")
    • for i=1,3 do
    • print(i..string.rep("!",i))
    • end
    • print("We're so good at counting!")
    • kata = {}
    • function kata.foo()
    • return "expected"
    • end
    • return kata
Algorithms
Logic
Mathematics
Numbers

Recursion based implementations are not a great idea to count factorials. :)

Code
Diff
  • def factorial(x):
        result = 1
        for i in range(2, x + 1):
            result *= i
        return result
    
    • def factorial(x):
    • return x * factorial(x-1) if x > 0 else 1
    • result = 1
    • for i in range(2, x + 1):
    • result *= i
    • return result
Code
Diff
  • def ls(dir):
        import os    
        return(os.listdir(dir))
    • import os
    • print(os.listdir('directorypath'))# Replace 'directorypath' with path to directory
    • def ls(dir):
    • import os
    • return(os.listdir(dir))
Code
Diff
  • def sortinggggggggggg (arr) :
      Soreteddddd = sorted (arr)
      print (Soreteddddd)
      return Soreteddddd
    sortinggggggggggg ([2,0,25,3])
    
    • def sortinggggggggggg (arr) :
    • Soreteddddd = sorted (arr)
    • print (Soreteddddd)
    • return Soreteddddd
    • sortinggggggggggg ([2,0,25,3])
Strings
Data Types

Last Character of a string in JS.

Code
Diff
  • const lastChar=(s)=>s.slice(-1)
    
    • def last_char(str):
    • return str[-1]
    • const lastChar=(s)=>s.slice(-1)

version for Python 3.4.3

Code
Diff
  • import codecs
    
    def caesar(s):
        return codecs.encode(s, 'rot_13')
    
    • # caesar cipher shifted of 13 characters with maketrans for python 2.7
    • from string import maketrans
    • import string
    • import codecs
    • def caesar(s):
    • print(s)
    • s=s.translate(maketrans(string.ascii_uppercase, string.ascii_uppercase[13:]+string.ascii_uppercase[:13]))
    • return s
    • return codecs.encode(s, 'rot_13')