← Back to challenges

Reverse Coding Challenge #4

PythonHardarraysstrings

Instructions

This is a reverse coding challenge. Normally you're given explicit directions with how to create a function. Here, you must generate your own function to satisfy the relationship between the inputs and outputs.

Your task is to create a function that, when fed the inputs below, produce the sample outputs shown.

Examples

"hello" ➞ [4, 1, 3, 3, 1]

"maybe" ➞ [4, 2, 1, 3, 1]

"hopeless" ➞ [0, 7, 0, 5, 4, 5, 3, 3]

"higher" ➞ [2, 3, 1, 2, 5, 0]

"movement" ➞ [5, 7, 6, 5, 5, 5, 6, 4]

Notes

If you get stuck, see Comments for a hint.

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