← Back to challenges

Vertical Text

PythonHardarraysformatting

Instructions

Create a function that converts a string into a matrix of characters that can be read vertically. Add spaces when characters are missing.

Examples

vertical_txt("Holy bananas") ➞ [
  ["H", "b"],
  ["o", "a"],
  ["l", "n"],
  ["y", "a"],
  [" ", "n"],
  [" ", "a"],
  [" ", "s"]
]

vertical_txt("Hello fellas") ➞ [
  ["H", "f"],
  ["e", "e"],
  ["l", "l"],
  ["l", "l"],
  ["o", "a"],
  [" ", "s"]
]

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.