new to python and I have this assingment: I need to write a recursive function that takes paramaters (aString,nTimes ) and it needs to print the aString parameter the number of times specified by nTimes. I cannot use a for or while loop, just recursion. How would I go about doing this? all i know how to do is get it started and use recursion to call function again.
def printNtimes(aSt ring,nTimes):
I also know how to do it using recursion with one parameter:
[CODE=python]
def n_lines(n):
if n>0:
print "Line"
n_lines(n-1)[/CODE]
def printNtimes(aSt ring,nTimes):
I also know how to do it using recursion with one parameter:
[CODE=python]
def n_lines(n):
if n>0:
print "Line"
n_lines(n-1)[/CODE]
Comment