Advertisement
Nenogzar

swastika

Mar 24th, 2024
751
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. def print_swastika(rows, cols):
  2.     for i in range(rows):
  3.         for j in range(cols):
  4.             if i < rows // 2:
  5.                 if j < cols // 2:
  6.                     if j == 0:
  7.                         print("#", end=" ")
  8.                     else:
  9.                         print(" ", end=" ")
  10.                 elif j == cols // 2:
  11.                     print("#", end=" ")
  12.                 else:
  13.                     if i == 0:
  14.                         print("#", end=" ")
  15.                     else:
  16.                         print(" ", end=" ")
  17.             elif i == rows // 2:
  18.                 print("#", end=" ")
  19.             else:
  20.                 if j > cols // 2:
  21.                     if j == cols - 1:
  22.                         print("#", end=" ")
  23.                     else:
  24.                         print(" ", end=" ")
  25.                 elif j == cols // 2:
  26.                     print("#", end=" ")
  27.                 else:
  28.                     if i == rows - 1:
  29.                         print("#", end=" ")
  30.                     else:
  31.                         print(" ", end=" ")
  32.         print()
  33.  
  34. # For correct figure, enter only odd values for column and row
  35. print_swastika(5, 5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement