You are viewing a single comment's thread. Return to all comments →
Used string cropping for this one
def print_rangoli(size): letters = [x for x in range(1, size + 1)] string = [chr(ord('a') + n - 1) for n in letters] if (size == 1): print("".join(string)) return string_reversed = "-".join(string) string = reversed(string) string = "-".join(string) size *= 2 for x in range(1, size, 2): print(f"{string[:x]:->{size - 1}}-{string_reversed[(size - x + 1):]:-<{size - 3}}") for x in reversed(range(1, size - 1, 2)): print(f"{string[:x]:->{size - 1}}-{string_reversed[(size - x + 1):]:-<{size - 3}}")
Seems like cookies are disabled on this browser, please enable them to open this website
Alphabet Rangoli
You are viewing a single comment's thread. Return to all comments →
Used string cropping for this one