Advertisement
ad2bg

Diamond

Jun 4th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. n = int(input())
  2.  
  3. e = n % 2 == 0
  4. nn = n - 1 if e else n
  5. m = (nn + 1) / 2
  6.  
  7. for i in range(1, nn + 1):
  8.     d = int(abs(m - i))
  9.     print(
  10.         '-' * d +
  11.         '*' +
  12.         '-' * ((nn + 1) - 2 - 2 * d - (0 if e else 1)) +
  13.         ("" if ((2 * d + 1 == nn) and not e) else "*") +
  14.         '-' * d)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement