We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Strings
- Alphabet Rangoli
- Discussions
Alphabet Rangoli
Alphabet Rangoli
Sort by
recency
|
1391 Discussions
|
Please Login in order to post a comment
For those who would be interested in my decision:
def print_rangoli(size): max_letter_num = size + 96 dash = '-' new_list = [] for row in range(size): a = [chr(max_letter_num - num) for num in range(size - row)] new_list.append(a)
I really enjoyed how it challenges you to think about symmetry and spacing while working with characters from the alphabet. 11xplay ID
This here seems to be much easier with simple mirroring technique
def print_rangoli(size): alpha = "abcdefghijklmnopqrstuvwxyz" width = size *4 -3 for i in range(size-1, -1, -1): left = alpha[size-1: i : -1] mid = alpha[i] right = alpha[i+1 :size ]
if name == 'main': n = int(input()) print_rangoli(n)
if you guies want a math, no list and pure logical then can reffer to this:
Am I dumb?