Challenge 2: Count Iterations of a Loop Until a Condition
This challenge will test your knowledge of while loops.
We'll cover the following
xis provided to you.
Repeatedly decrease the value of the variable
xby 3 each time, as long as
xis greater than or equal to 0.
Print the number of times the iteration runs.
Write your code below. It is recommended that you try solving the exercise yourself before viewing the solution.
Note: There is a
testfunction given in the code for testing purposes. Do not modify it.
Important Note: A mutable variable
xis already provided to you. This has the desired value. You just have to write the
Good luck! 🤞