here2share

# b_nth_diamond.py

Apr 11th, 2021 (edited)
502
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # b_nth_diamond.py
  2.  
  3. def nth_diamond(nth):
  4.     s = []
  5.     for j in range(nth+1):
  6.         t = '   '+'  '*(nth-j)+'*   '*j
  7.         s += [t]
  8.     s = s[:-1]+s[::-1]
  9.     return '\n'.join(s)
  10. print nth_diamond(5)
RAW Paste Data