We're a place where coders share, stay up-to-date and grow their careers.
Python
def diamond(): num = 9 for i in range(1, num+1): i = i - (num//2 +1) if i < 0: i = -i print(" " * i + "*" * (num - i*2) + " "*i) diamond()
The shortest one by far
It's also fast.
Python
The shortest one by far
It's also fast.