Letter Diamond

A letter diamond is built symmetrically: the rows go from A up to the given letter, then back down again. The function rows receives a letter and returns the diamond as a list of strings. Every row should have the same width, with the correct spaces inside and around the letters.

Примеры

Ввод
"A"
Вывод
["A"]
Ввод
"B"
Вывод
[" A ", "B B", " A "]
Ввод
"C"
Вывод
[" A ", " B B ", "C C", " B B ", " A "]

Нужно реализовать

def rows(letter: str) -> list[str]:

Теги

stringslists
PostgreSQLv16

Hawn jidher ir-riżultat tat-tħaddim tal-kodiċi

Visible tests
1
Input
"A"
Expected["A"]
2
Input
"B"
Expected[" A ","B B"," A "]
3
Input
"C"
Expected[" A "," B B ","C C"," B B "," A "]
4
Input
"D"
Expected[" A "," B B "," C C ","D D"," C C "," B B "," A "]
Focus radio
Paused · SomaFM · Fluid