DEV Community

Discussion on: Daily Challenge #202 - Complete the Pattern II

Collapse
 
rafaacioly profile image
Rafael Acioly

Python solution 🐍

EMPTY_RESPONSE = " "
MIN_DIGIT = 1

def pattern(value: int) -> str:
    if not value:
        return EMPTY_RESPONSE

    items = [str(i) for i in reversed(range(MIN_DIGIT, n + MIN_DIGIT))]

    return "".join(items)