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
|
1330 Discussions
|
Please Login in order to post a comment
def print_rangoli(size): length=((size * 2) - 1) base = [abs(size - x - 1) for x in range(length)] for i in range(length): new = [x + base[i] for x in base] prepend='' for e in new: if e > size - 1: print(prepend+'-', end='') else: print(prepend+chr(ord('a')+e), end='') prepend='-' print('')
for Python3 Platform
**def print_rangoli(size): # your code goes here alphabet=[chr(i) for i in range(97,123)] alphabet=alphabet[:size]
if name == 'main': n = int(input()) print_rangoli(n)**