Lochard avatar

CoddeWars Kata - If you can't sleep, just count sheep!!

lochard

Published: 07 Aug 2023 › Updated: 07 Aug 2023CoddeWars Kata - If you can't sleep, just count sheep!!

CoddeWars Kata - If you can't sleep, just count sheep!!

DESCRIPTION:
If you can't sleep, just count sheep!!

Task:
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.

def count_sheep( n ):
    return "".join( [ str( i ) + " sheep..." for i in range( 1, n + 1 ) ] 

Leave CoddeWars Kata - If you can't sleep, just count sheep!! to:

Written by

Asylum seeker who hopes to be rid of authoritarian and their surveillance.

Read more #programming posts


Best Posts From Lochard

We have not curated any of lochard's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Lochard