fork download
  1. from itertools import chain
  2.  
  3. w = max(int(input()), 2)
  4. h = max(int(input()), 2)
  5.  
  6. print(
  7. ('{0}' * w + ('\n{0}' + '{1}'*(w - 2) + '{0}')*(h - 2) + '\n' + '{0}' * w)
  8. .format('o', ' ')
  9. )
  10.  
  11. print('\n')
  12.  
  13. print(
  14. '\n'.join(
  15. ''.join(map(str, range((i + 1) * 2 - 1, w * 2, 2))) +
  16. '{1}' * (2 * i) +
  17. ''.join(map(str, range(w * 2 - 1, i * 2, -2)))
  18. for i in chain(range(0, w), range(w - 1, -1, -1))
  19. )
  20. .format('o', ' ')
  21. )
Success #stdin #stdout 0.1s 10104KB
stdin
5
4
stdout
ooooo
o   o
o   o
ooooo


1357997531
3579  9753
579    975
79      97
9        9
9        9
79      97
579    975
3579  9753
1357997531