DEV Community

Discussion on: Daily Challenge #2 - String Diamond

Collapse
 
0xyasser profile image
Yasser A

Python

def asterisk():
    n = [*range(1,10), *reversed(range(1,9))]
    for r in n:
        l = []
        for c in n:
            x = r + c - 9
            l.append('*' if x > 0 else ' ')
        print(' '.join(l))