DEV Community

Discussion on: Daily Challenge #40 - Counting Sheep

Collapse
 
hectorpascual profile image

Python :

def count_sheep(n):
    for i in range(1,n+1):
        print(f"{i} sheep...", end=' ')

In one line :

count_sheep = lambda n : print(''.join([f"{i} sheep... " for i in range(1,n+1)]))