Advertisement
here2share

# b_nth_diamond_recursive.py

Apr 11th, 2021
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. # b_nth_diamond_recursive.py
  2.  
  3. def nth_diamond(nth,i=0,s=[]):
  4.     t = '   '+'  '*(nth-i)+'*   '*i
  5.     s.append(t)
  6.     if i < nth:
  7.         nth_diamond(nth,i+1)
  8.     s = s[:-1]+s[::-1]
  9.     return '\n'.join(s)
  10. 0
  11. print nth_diamond(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement