Advertisement
Spocoman

10. Diamond

Jan 4th, 2022 (edited)
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. n = int(input())
  2.  
  3. for i in range(n + n % 2 - 1):
  4.     x = i if i < n // 2 + n % 2 else x - 1
  5.     out_dashes = '-' * ((n - 1) // 2 - x)
  6.     in_dashes = '-' * (x * 2 - (n % 2))
  7.  
  8.     print(f"{out_dashes}*{in_dashes}{'' if n % 2 == 1 and x == 0 else '*'}{out_dashes}")
  9.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement