Program to repeat name without using for loop is possible using self recursive function calling condition is set inside the function .function is calling itself 10 times because condition is set of count less than 10 function body print name and calling function itself.so using recursive call function it is possible to print name ten times without using for loop.
Program
count=0
def repeatname(n):
global count
if count<10:
print(n);
count=count+1
repeatname(n)
repeatname('ram')
Output
ram
ram
ram
ram
ram
ram
ram
ram
ram
ram
=== Code Execution Successful ===
0 Comments