here2share

# b_nth_diamond.py

Apr 11th, 2021 (edited)
842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  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)
Add Comment
Please, Sign In to add comment