You are viewing a single comment's thread. Return to all comments →
def encryption(s): s = s.replace(" ", "") l = len(s) sqrt = math.sqrt(l) cols = math.ceil(sqrt) rows = math.floor(sqrt) if rows * cols < l: rows = cols split_str = [] for i in range(0, l, cols): split_str.append(s[i: i+cols]) return_str = "" rows_count = 0 cols_count = 0 while cols_count < cols: while rows_count < rows and cols_count < len(split_str[rows_count]): return_str += split_str[rows_count][cols_count] rows_count += 1 rows_count = 0 return_str += " " cols_count += 1 return return_str
Seems like cookies are disabled on this browser, please enable them to open this website
Encryption
You are viewing a single comment's thread. Return to all comments →