samedi 10 avril 2021

Given a positive integer 'n' less than or equal to 26, you are required to print the below pattern in python [closed]

The pattern should include a "pyramid" of letters and dashes as seen below. The "largest" letter should correspond to the provided integer as its index in the alphabet (hence the limit on 26). The total number of characters in each row should be the same, so the number of dashes should be according to this.

Sample Input: 5

Sample Output : --------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--------

Sample Input : 3

Sample Output : ----c---- --c-b-c-- c-b-a-b-c --c-b-c-- ----c----

Aucun commentaire:

Enregistrer un commentaire