Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Given an integer n, print the following pattern using alphabets in Python

0 votes
asked Sep 29, 2018 by Venkat
#Size 5

--------e--------

------e-d-e------

----e-d-c-d-e----

--e-d-c-b-c-d-e--

e-d-c-b-a-b-c-d-e

--e-d-c-b-c-d-e--

----e-d-c-d-e----

------e-d-e------

--------e--------

1 Answer

0 votes
answered Jan 7, 2020 by anonymous
import string

n = int(input())

a = string.ascii_lowercase

# Write your code below

List = []

for i in range(n):

    s = "-".join(a[i:n])

    List.append(s[::-1]+s[1:])

width = len(List[0])

for i in range(n-1, 0, -1):

    print(List[i].center(width, "-"))

for i in range(n):

    print(List[i].center(width, "-"))
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...