File: recursion

package info (click to toggle)
sugar-pippy-activity 25-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 572 kB
  • ctags: 234
  • sloc: python: 1,237; makefile: 15
file content (10 lines) | stat: -rw-r--r-- 268 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
def countbackwards(number):
    print "I have the number", number
    if number > 0:
        print "Calling countbackwards again!"
        countbackwards(number-1)
    else:
        print "I am done counting"

number = input("Enter a number: ")
countbackwards(number)