SHARE
TWEET

Untitled

a guest May 19th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from math import ceil
  2.  
  3. inp = int(input('1 - from file; 2 - from keyboard: '))
  4. if inp == 1:
  5.     with open('input.txt', 'r') as fin:
  6.         a = fin.readline()
  7. else:
  8.     a = input('a = ')
  9. a = a.replace(' ', '')
  10.  
  11. out = int(input('1 - to file; 2 - to screen: '))
  12. if out == 1:
  13.     fout = open('output.txt', 'w')
  14. else:
  15.     fout = None
  16.  
  17. rows = ceil(len(a) ** 0.5)
  18. ml = rows * 2 - 1
  19. for i in range(rows):
  20.     cl = i * 2 + 1
  21.     print(' ' * ((ml - cl) // 2), a[i * i:(i + 1) ** 2], sep='')
  22. if out == 1:
  23.     fout.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top