DEV Community

Discussion on: Daily Challenge #2 - String Diamond

Collapse
 
highcenburg profile image
Vicente G. Reyes

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()
Collapse
 
garrett profile image
Garrett / G66 / megabyteGhost

The shortest one by far

Collapse
 
highcenburg profile image
Vicente G. Reyes

It's also fast.