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

add

def add(a,b):
    return 1

Showing how sync events work in c#, not so pratical as in c# 6 and forward is a good practice writing async code.

using System;

namespace delegates
{
	class Program
	{
		static void Main()
		{
		    // Creates a new instance
			Message hi = new Message();
			
			/*
			set the event of the class instance to a 
			lambda expression, beeing an event handler that has the same parameter
			and return type of the delegate in the class instance.
			
			equivalent of creating a new void method with the same
			parameters and seting it to the event in the class instance
			
			*/
			hi.writed += (string hello) =>
			{
			    Console.WriteLine(hello);
			};
			
			// executes the method to validate the event and add it to the delegate
			hi.write = "write property";
		}
	}
	
	public class Message
	{
	    
	    //creates the delegate that will handle the method/ lambda expression/ anonnymous method passed through it
	    public delegate void handler(string hello);
	    
	    //creates the event with the delegate
	    public event handler writed;
	    
	    //method that will check for the event while executing
	    
	    private string _write;
	    public string write
	    {
	        get
	        {
	            return _write;
	        }
	        set
	        {
	            if(value == "write property")
	            {
	               writed?.Invoke("the event was thrown!!!");
	            }
	            
	            Console.WriteLine(value);
	            
	            _write = value;
	        }
	    }
	    
	   //The same as:
	   
	   // public void write(string text)
	   // {
	   //     //you have to check if the event is not null becouse you can't execute a delegates method if it does not exist
	   //     //(the event handler was not set yet)
	   //     if(text == "write method" && writed != null)
	   //     {
	   //         writed("the event was thrown!!!");
	   //     }
	   //     Console.WriteLine(text);
	       
    }
}
list = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
for i in list :
    if i % 15 == 0 :
        print('Fizz Buzz')
    elif i % 3 == 0 :
        print('Fizz')
    elif i % 5 ==0 :
        print('Buzz')
    else :
        print(i)

Test

function main()
{
  return 12
}

Inside a list of words, return the longest of them.

def getLongestWord(words):
    longest = ""
    for w in words:
        longest = w if len(w) > len(longest) else longest
    return longest

Given a number, write a function that prints a square with the caracter '*'

def square(n):
    l=''
    square1=[]
    for i in range(n):
        l+='*'
    for i in range(n):
        square1.append(l)
    for i in range(n):
        print(square1[i])    
    return square1

Return the bigger integer

public class BiggerNum{

  public static int compare(int a, int b) {
    return 0;
  }

}

Write a program that take as imput a string (made of only numbers and letters) and returns the morse code equivalent.

dot='.'
dash='-'
morse = {'a':[dot,dash],'b':[dash,dot,dot,dot],'c':[dash,dot,dash,dot],'d':[dash,dot,dot],'e':[dot],'f':[dot,dot,dash,dot],'g':[dash,dash,dot],'h':[dot,dot,dot,dot],""
         'i':[dot,dot],'j':[dot,dash,dash,dash],'k':[dash,dot,dash],'l':[dot,dash,dot,dot],'m':[dash,dash],'n':[dash,dot],'o':[dash,dash,dash],'p':[dot,dash,dash],'q':[dash,dash,dot,dash],""
         'r':[dot,dash,dot],'s':[dot,dot,dot],'t':[dash],'u':[dot,dot,dash],'v':[dot,dot,dot,dash],'w':[dot,dash,dash],'x':[dash,dot,dot,dash],'y':[dash,dot,dash,dash],'z':[dash,dot,dot],""
         '0':[dash,dash,dash,dash,dash],'1':[dot,dash,dash,dash,dash],'2':[dot,dot,dash,dash,dash],'3':[dot,dot,dot,dash,dash],'4':[dot,dot,dot,dot,dash],'5':[dot,dot,dot,dot,dot],""
         '6':[dash,dot,dot,dot,dot],'7':[dash,dash,dot,dot,dot],'8':[dash,dash,dash,dot,dot],'9':[dash,dash,dash,dash,dot]}

def morse_code(msg):
    code=''
    for i in msg:
        if i==' ':
            code+=' '
        else:
            for j in morse[i.lower()]:            
                code+=j
    return code

        
print(morse_code('1122'))

Il faut créer une fonction qui s'appelle quiEstLeMeilleurProf et qui retourne la phrase suivante : "Mon prof de programmation Web"

function quiEstLeMeilleurProf(){
  return "Mon prof de programmation Web";
}

Il faut créer une fonction qui s'appelle quiEstLeMeilleurProf et qui retourne la phrase suivante : "Mon prof de programmation Web"

function quiEstLeMeilleurProf(){
  return "Mon prof de programmation Web";
}