avatar Bite 37. Rewrite a for loop using recursion

Although you have to be careful using recursion it is one of those concepts you want to at least understand. It's also commonly used in coding interviews :)

In this beginner Bite we let you rewrite a simple countdown for loop using recursion. See countdown_for below, it produces the following output:

$ python countdown.py
10
9
8
7
6
5
4
3
2
1
time is up

You will be tested on having the same output, making it work with another start value, and of course if you used recursion. Have fun!

Login and get coding
go back Beginner level
Bitecoin 2X

866 out of 889 users completed this Bite.
Will you be the 867th person to crack this Bite?
Resolution time: ~28 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 2.58 on a 1-10 difficulty scale.
» You can do it! 😌

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help