Bicorn

Untitled

Dec 1st, 2020 (edited)
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. #my solution
  2. def piirra_x(h):
  3.     for n in range(h):
  4.         m = max(n+1, h-n)
  5.         spc = min(n, h-1-n)
  6.         for o in range(m):
  7.             if o == m-1 or o == spc:
  8.                 print('*', end='')
  9.             else:
  10.                 print(' ', end='')
  11.         print()
  12.  
  13. #instructor's solution
  14. def piirra_x(h):
  15.     for x in range(h):
  16.         for y in range(h):
  17.             if y == x or y == h - 1 - x:
  18.                 print('*', end='')
  19.             else:
  20.                 print(' ', end='')
  21.         print()
Add Comment
Please, Sign In to add comment