The code above is written with four leading spaces on each line. This is known as basic block format.
We can preserve the formatting of program code and give it syntax highlighting with three backticks before and after the code block sample.
See this page for more details:
As to your first question, the exercise does not actually ask us to get user input, just call the function at the end. See the instructions and be sure to complete that last step. The above example code can be pasted at the very end, and may be rejected by the SCT, so pass the lesson first, then try that code.