Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import ceil
- inp = int(input('1 - from file; 2 - from keyboard: '))
- if inp == 1:
- with open('input.txt', 'r') as fin:
- a = fin.readline()
- else:
- a = input('a = ')
- out = int(input('1 - to file; 2 - to screen: '))
- if out == 1:
- fout = open('output.txt', 'w')
- else:
- fout = None
- rows = ceil(len(a) ** 0.5)
- ml = rows * 2 - 1
- for i in range(rows):
- cl = i * 2 + 1
- print(' ' * ((ml - cl) // 2), a[i * i:(i + 1) ** 2], sep='')
- if out == 1:
- fout.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement