## very simple recursion examples. def repeat(n, ch): """prec: n is an ineger, ch is a one-character string postc: returns a string of length n containing the character ch.""" if n == 0: return "" #base case return ch + repeat(n - 1, ch) def print_repeat(n, ch): """prec: n is an ineger, ch is a one-character string postc: print a string of length n containing the character ch.""" if n == 0: # base case: is there more to do? print("") #if there isn't finish up return print(ch, end="") #recursive step print_repeat(n - 1, ch) #recursive step def main(): print(repeat(50, "*")) print_repeat(50, "*") main()