3 If you can’t sleep, just count sheep!!
8Kyu Tantangan #3/366 - 03 Feb 2025
https://www.codewars.com/kata/5b077ebdaf15be5c7f000077
3.1 Instruction
Given a non-negative integer,
3
for example, return a string with a murmur:"1 sheep…2 sheep…3 sheep…"
. Input will always be valid, i.e. no negative integers.
3.2 YouTube Video
3.3 Solution Code
Solusi bar-bar
Solusi simple
3.4 Test
library(testthat)
test_that("Fixed tests", {
expect_equal(countSheep(0), "")
expect_equal(countSheep(1), "1 sheep...")
expect_equal(countSheep(2), "1 sheep...2 sheep...")
expect_equal(countSheep(3), "1 sheep...2 sheep...3 sheep...")
})
## Test passed 🥳
Supported by