File: recursion

package info (click to toggle)
sugar-pippy-activity 76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,664 kB
  • sloc: python: 5,860; makefile: 16; sh: 1
file content (10 lines) | stat: -rw-r--r-- 283 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
def count_backwards(number):
    print('I have the number', number)
    if number > 0:
        print('Calling count_backwards again!')
        count_backwards(number - 1)
    else:
        print('I am done counting')

number = eval(input('Enter a number: '))
count_backwards(number)