```py def squared(word: str, number: int): #multiplying by an arbitrarily big number to have enough characters letters = [l for l in word * (number * 99)] counter = 0 for i in range(len(letters) + 1): if i % number == 0 and i != 0: if i == number: letters.insert(i, "\n") counter += 1 else: letters.insert(i + counter, "\n") counter += 1 rows = ("".join(letters)) print(rows[:number ** 2 + number - 1]) if __name__ == "__main__": squared("aybabtu", 5)``` this is disgusting. im surprised it even works.
That making a huge list so you can just repeat the op a lot is a bit... Unconventional, to say the least. Can't you modulo the number to save space and not have to unnecessarily use so much space?