In this we are going to see a basic program to print alphabet rangoli of size 'n' in Python Programming Language.
def rangoli(sz):
characters = list(map(chr,range(ord('a'),ord('z')+1)))
design = []
for i in range(sz):
s = "-".join(characters[i:sz])
design.append((s[::-1]+s[1:]).center(4*sz-3, "-"))
print('\n'.join(design[:0:-1]+design))
def main():
n = int(input("Enter size of the rangoli characters: "))
rangoli(n)
main()
# Coded by Shreya Idate
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP