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

short

Code
Diff
  • ret_1=lambda:ord('d')/100
    • ret_1=lambda x:100-99
    • ret_1=lambda:ord('d')/100
Fundamentals

using sets

Code
Diff
  • class Solution:
        def __init__(self, n, lst1, lst2):
            self.n = n
            self.lst1 = set(lst1)
            self.lst2 = set(lst2)
            self.i=self.lst1.intersection(self.lst2)
            self.u=self.lst1.difference(self.lst2).union(self.lst2.difference(self.lst1))
            
        def xor_list(self):
            return self.n in self.u and self.n not in self.i
        
        
    • class Solution:
    • def __init__(self, n, lst1, lst2):
    • self.n = n
    • self.lst1 = lst1
    • self.lst2 = lst2
    • self.lst1 = set(lst1)
    • self.lst2 = set(lst2)
    • self.i=self.lst1.intersection(self.lst2)
    • self.u=self.lst1.difference(self.lst2).union(self.lst2.difference(self.lst1))
    • def xor_list(self):
    • pass
    • return self.n in self.u and self.n not in self.i

Smol

Code
Diff
  • solution = lambda: 10
    • def solution():
    • x = 33212112321312312 - 33212112321312302 * 1
    • return x
    • solution = lambda: 10
Puzzles
Logic

We have a programmer who is at peak performance when (1) they have coffee, (2) it's a weekend, (3) the hour is before 7:00 or after 22:00, and (4) the number of lines of code they produce is between 40 and 76, inclusive. Return True if the programmer is at peak perfomance, or False otherwise.

Code
Diff
  • def coffee_and_code(coffee, weekend, hour, code):
        return True if coffee and weekend and (hour <= 7 or hour >= 22) and code in range(40, 77) else False
    
    • def coffee_and_code(coffee, weekend, hour, code):
    • pass
    • return True if coffee and weekend and (hour <= 7 or hour >= 22) and code in range(40, 77) else False
Code
Diff
  • even_or_odd = lambda n:'Even' if n & 1 == 0 else 'Odd'
    • even_or_odd = lambda n:'Odd' if n%2 else 'Even'
    • even_or_odd = lambda n:'Even' if n & 1 == 0 else 'Odd'

Why you don't complete this kumite ¯\_(ツ)_/¯ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠎⡴⢦⠱⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⢎⣜⣉⣉⣧⡱⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⢃⡞⠒⣒⣒⠒⢳⡘⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⢡⣎⡩⠭⠤⠤⠭⢍⣱⡜⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡴⢡⡯⠴⢒⣈⣩⣉⣑⡒⠠⣹⡌⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡔⣡⣣⠔⡺⡋⡁⢀⡀⢈⠙⢟⠢⣝⣄⢢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡜⣰⡟⠁⢰⡓⢎⣀⣸⣿⣷⡱⢚⡆⠈⢻⣆⢣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠎⡼⣇⠣⡀⠸⡄⢊⢿⣿⣿⡿⡑⢠⠇⢀⠜⣸⢧⠱⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⢠⢋⢼⡙⢌⠳⣍⠲⢽⣄⣁⠂⠐⣈⣠⡯⠔⣡⠞⡡⢊⣧⡙⡄⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⣠⢃⣞⠣⡙⠦⡑⠦⣍⡒⠤⠬⠭⠭⠥⠤⢒⣩⠴⢊⠴⢋⠜⣳⡘⣄⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⣰⣃⣛⣚⣓⣚⣓⣚⣓⣒⣛⣛⣓⣒⣒⣚⣛⣛⣒⣚⣓⣚⣓⣚⣒⣛⣘⣆⠀⠀

why map when you can listcomp?

Code
Diff
  • why = lambda: "".join([chr(int(i)) for i in '1196932694569326910469326945693269121'.split("69")])
    • why = lambda: "".join(map(lambda _: chr(int(_)),'1196932694569326910469326945693269121'.split("69")))
    • why = lambda: "".join([chr(int(i)) for i in '1196932694569326910469326945693269121'.split("69")])
Code
Diff
  • def return_hundred():
        f = 99 + 1
        return f
    • def return_hundred():
    • if 8 == 0:
    • return 100 + 10
    • else:
    • return 100 - 0 + 0 - 0
    • return (1829-1762+21)/100 + 99.12
    • f = 99 + 1
    • return f