반응형
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.
Solution:
def count_sheep(n):
return ''.join(f"{i} sheep..." for i in range(1, n+1))
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
Find the stray number (0) | 2022.08.19 |
---|---|
5 without numbers !! (0) | 2022.08.19 |
Row Weights (0) | 2022.08.16 |
Playing with digits (0) | 2022.08.15 |
Give me a Diamond (0) | 2022.08.14 |