Alphabet Rangoli

  • + 0 comments

    def print_rangoli(size): # your code goes here for x in range (96+size,96,-1): listcharsl = [chr(c) for c in range (96+size,x-1, -1)] listcharsr = [chr(c) for c in range (x+1,97+size)] print ("--"(x-97),"-".join(listcharsl), "-" if listcharsr else "", "-".join(listcharsr),"--"(x-97), sep="")

    for x in range (1,size):
        listcharsl.pop()
        listcharsr.pop(0)
        print ("--"*(x),"-".join(listcharsl), "-" if listcharsr else "", "-".join(listcharsr),"--"*(x), sep="")