def loop(x):
if x==0:
return
else:
for i in range(1,x+1):
print(i,end='')
print()
loop(x-1)
loop(5)
def strloop(x):
if len(x)==0:
return
else:
for i in range(len(x)):
print(x[i],end='')
print()
strloop(x[:-1])
strloop('abcde')
def fact(n):
if n==1:
print(str(1)+'='+str(1))
exit()
else:
s = 1
for i in range(1,n+1):
s*=i
if i!=n:
print(i,end='*')
else:
print(i,end='=')
print(s)
fact(n-1)
print(fact(5))
沒有留言:
張貼留言