35
3
Given a letter of the English alphabet, your task is to build a semi-diagonal alphabet to the input.
How to build a Semi-Diagonal alphabet?
Brief Description:
First, you take the position of the letter in the alphabet, P
(P
is 1-indexed here). Then, you print each letter until the input (inclusive) on a line, preceded by P-1
and repeat that letter P
times, interleaving with spaces.
Examples:
Given
F
, your program should output:A B B C C C D D D D E E E E E F F F F F F
Given
K
, your program should output:A B B C C C D D D D E E E E E F F F F F F G G G G G G G H H H H H H H H I I I I I I I I I J J J J J J J J J J K K K K K K K K K K K
Given
A
, your program should output:A
Rules
You may choose either lowercase or uppercase characters, but that should be consistent.
You may have extraneous spaces as follows:
- One consistent leading space (on each line).
- A trailing or leading newline(s).
- Trailing spaces.
Input and output can be taken by any standard mean, and default loopholes apply.
You are allowed to output a list of lines instead, as long as you also provide the ascii-art version.
This is code-golf, so the shortest code in bytes wins!
Inspired by this challenge.
Is output as list of strings ok? – Adám – 2017-08-23T15:16:53.067
It says under the rules that a list of lines is ok. I would assume this would mean yes @Adám – jkelm – 2017-08-23T15:19:33.067
Ah, I can't read. – Adám – 2017-08-23T15:20:23.767
2Why the downvote? What can i improve? – None – 2017-08-23T15:45:53.993
1When you say "P is 1-indexed here", does here refer to the challenge or the example? – Dave – 2017-08-23T15:48:39.610
@pizzakingme The example, of course.
P
has no relevance overall – Mr. Xcoder – 2017-08-23T15:49:36.423To rephrase, can we index from 0 and exclude the inputted character from the output? – Dave – 2017-08-23T16:00:59.717
3@pizzakingme No, you may not. – None – 2017-08-23T16:05:08.267
1
I accidentlly got an interesting pattern while golfing my answer: https://tio.run/##K0nO@f@/OLVEIVGhupYLxMhUMDPlKsnMTVWohohHp@UX5SaWKMQoqCYrqGTGqiRaF5SWFMPFVaNTKwqKQDLFCiqJsdaZeclFCpm1CkZm//8DAA
– sergiol – 2017-10-19T19:19:52.177Almost: https://tio.run/##K0nO@f@/OLVEIVGhupYLxMhUMDPhKsnMTVWohoirJEan5RflJpYoqBolK0Rn5iUXKWTGxloXlJYUK8ClIOLJCsaxMcVALbG1CkZm//8DAA
– sergiol – 2017-10-19T20:09:14.517