Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. def printn(n):
  2.     i = n
  3.    
  4.     if n == 0:
  5.         c = 2
  6.     else:
  7.         c = 3
  8.        
  9.     while i > 0:
  10.         c -= 1
  11.         i //= 10
  12.        
  13.     print(' ' * c + str(n), end="")
  14.  
  15. def rowprint(row, col):
  16.     for i in range(row):
  17.         if i % 2 == 0:
  18.             for j in range(col):
  19.                 printn(j + i * col)
  20.         else:
  21.             for j in range(col - 1, -1, - 1):
  22.                 printn(j + i * col)
  23.         print()
  24.            
  25.        
  26.        
  27. row, col = map(int, input().split())
  28.  
  29. rowprint(row, col)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement