Write a programBasic10 XPExercise 5/9
Characters and their positions
Task
The program reads a string and for each character prints a line with the character and its position (index) in the string, separated by a space. Positions start at 0.
Examples
Input
Ahoj
Expected output
A 0 h 1 o 2 j 3
Rules
Use a
whileloop in this lesson.
After you submit, 3 hidden tests will also check your solution: one character, an empty string, a string with a digit.
Python starts the first time you run code.
Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.
Input (stdin)
Each line = one call to input().
Output
Hints
Try it yourself first. Each hint reveals a little more - and lowers the reward a little.
Signed out, hints are free - but no XP is awarded either.
Solution
The solution unlocks after the last hint.