Functions Challenge Question
For this challenge question, you are going to practice both writing functions and while
loops!
Part 0. Setup
Start by opening your workspace in Visual Studio. Right click on the “lessons” folder and select “add file”. Your file will be named evens_function.py
.
Set up your document by adding a docstring and initializing the __author__
variable with your PID.
Part 1. display_evens()
Now, write a function called display_evens
that takes as input an integer and does the following:
- prints all even numbers less than or equal to that input number in decreasing order down to 0 and
- returns the original number.
For example, display_evens(6)
should print:
6
4
2
0
and return the value 6
.
Submission
Create a .zip file by running the following command in your terminal:
python -m tools.submission lessons/evens_function.py
Then, drag and drop that .zip file into Gradescope!