You are viewing a single comment's thread. Return to all comments →
Here is my Python code! Suprisingly, we do not need to know how many rows there are!
def encryption(s): news = [s[i] for i in range(len(s)) if s[i] != " "] if math.sqrt(len(news)) == int(math.sqrt(len(news))): col = int(math.sqrt(len(news))) elif math.floor(math.sqrt(len(news))) * math.ceil(math.sqrt(len(news))) >= len(s): col = math.ceil(math.sqrt(len(news))) else: col = math.ceil(math.sqrt(len(news))) encoded = [[] for part in range(col)] for letter in range(len(news)): encoded[letter % col].append(news[letter]) encoded = ["".join(encoded[i]) for i in range(len(encoded))] return " ".join(encoded)
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 →
Here is my Python code! Suprisingly, we do not need to know how many rows there are!