return function(n) return ('H'):rep(n) end
def theletterh(howmuchh=1):for i in range(howmuchh):print('H')return 'H' * howmuchh#H return and H print (H😀😃😁)- return function(n)
- return ('H'):rep(n)
- end
local theletterh = require 'solution' describe("The H", function() it("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\nH \nHHHHH", function() assert.equals("HHH", theletterh(3)) assert.equals("", theletterh(0)) assert.equals("H", theletterh(1)) end) end)
import codewars_test as test- local theletterh = require 'solution'
import solution # H# H@test.describe("The H")def test_group():@test.it("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH")def test_case():test.assert_equals(theletterh(3), 'HHH')test.assert_equals(theletterh(0), '')test.assert_equals(theletterh(1), 'H')- describe("The H", function()
- it("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
- H
- HHHHH", function()
- assert.equals("HHH", theletterh(3))
- assert.equals("", theletterh(0))
- assert.equals("H", theletterh(1))
- end)
- end)
Fundamentals
Games
return {riddle = load("\27LuaS\0\25\x93\13\n\26\n\4\8\4\8\8xV\0\0\0\0\0\0\0\0\0\0\0(w@\0\0\1\0\0\0\1\0\0\0\1\0\2\4\0\0\0\\\0\0\0N\0\xc0\0f\0\0\1&\0\x80\0\1\0\0\0\19\1"..("\0"):rep(27))}
local solution = {}function solution.riddle(str)return #str-1endreturn solution- return {riddle = load("\27LuaS\0\25\x93\13\n\26\n\4\8\4\8\8xV\0\0\0\0\0\0\0\0\0\0\0(w@\0\0\1\0\0\0\1\0\0\0\1\0\2\4\0\0\0\\\0\0\0N\0\xc0\0f\0\0\1&\0\x80\0\1\0\0\0\19\1"..("\0"):rep(27))}
#include <stdbool.h> bool bool_check(bool bools[3]) { // saved by the padding gods return __builtin_popcount(*(int*)bools) > 1; }
- #include <stdbool.h>
- bool bool_check(bool bools[3]) {
return bools[0] + bools[1] + bools[2] > 1;- // saved by the padding gods
- return __builtin_popcount(*(int*)bools) > 1;
- }
import re def remove_numbers(string): return ''.join(c for c in string if not c.isdigit())
- import re
- def remove_numbers(string):
return re.sub(r"[0-9]","",string)- return ''.join(c for c in string if not c.isdigit())
import codewars_test as test # TODO Write tests import solution # or from solution import example # test.assert_equals(actual, expected, [optional] message) @test.describe("Example") def test_group(): @test.it("Tests") def test_case(): test.assert_equals(remove_numbers("Hello world!"), "Hello world!") test.assert_equals(remove_numbers("2 times 2 is 4"), " times is ") test.assert_equals(remove_numbers("this is the year 2021"), "this is the year ") test.assert_equals(remove_numbers("3² = 9"), " = ") test.assert_equals(remove_numbers("(3) ~~ ③,3,༣"), "() ~~ ,,")
- import codewars_test as test
- # TODO Write tests
- import solution # or from solution import example
- # test.assert_equals(actual, expected, [optional] message)
- @test.describe("Example")
- def test_group():
- @test.it("Tests")
- def test_case():
- test.assert_equals(remove_numbers("Hello world!"), "Hello world!")
- test.assert_equals(remove_numbers("2 times 2 is 4"), " times is ")
- test.assert_equals(remove_numbers("this is the year 2021"), "this is the year ")
- test.assert_equals(remove_numbers("3² = 9"), " = ")
- test.assert_equals(remove_numbers("(3) ~~ ③,3,༣"), "() ~~ ,,")