- cols = math.ceil(len(message) / rows)
- if len(message) % rows == 0:
- part_cols = 0
- else:
- part_cols = rows - len(message) % rows
- full_cols = cols - part_cols
- columns = [message[i:i+rows] for i in range(0, full_cols * rows, rows)] + \
- [message[i:i+rows-1] for i in range(full_cols * rows, len(message), rows - 1)]
+ cols = round(len(message) / rows)
+ columns = [message[i:i+rows] for i in range(0, cols * rows, rows)]