1. Design a recursive function that accepts an integer argument, n, and prints every second number from n down to a minimum of 0. Assume that n is always a positive integer.
import time
def printNumberDown(n):
if n!=-1:
print(n)
time.sleep(1)
printNumberDown(n-1)
def main():
n=int(input("Enter n: "))
printNumberDown(n)
main()
Comments
Leave a comment