[Solved] Define a function count_down() that consumes a number a produces a string counting down to 1 [closed]


Not a code-writing service nor a tutorial. But for its simplicity’s sake, a possible solution could look like

def count_down(n):
    return ', '.join(str(i) for i in range(n, 0, -1))
    # return ', '.join(map(str, range(n, 0, -1)))

>>> count_down(5)
'5, 4, 3, 2, 1'

join, str, range are very fundamental functions/methods you should read up on in the documentation.

solved Define a function count_down() that consumes a number a produces a string counting down to 1 [closed]