ΪʲôҪдx*power(x,y-1)¿ÉÒÔ£¬Ð´power(x,y)¾Í²»ÐУ¬ÌáʾÎÒ³¬¹ý×î´óµÝ¹éÉî¶È
def power(x,y):if y:
return x*power(x,y-1)
else:
return 1
print(power(2,3)) ±¾Ìû×îºóÓÉ ÌÓ±ø ÓÚ 2021-9-25 14:56 ±à¼
Èç¹ûxºÍyûÓб仯µÄ»°£¬µÝ¹éûÓгö¿ÚÁË
¾ÍÏñ¸öËÀÑ»·
power(2,3)¡ú2 * power(2,3)¡ú2 * 2 * power(2,3)¡ú2* 2*2*power(2,3).... ÌÓ±ø ·¢±íÓÚ 2021-9-25 14:53
Èç¹ûxºÍyûÓб仯µÄ»°£¬µÝ¹éûÓгö¿ÚÁË
¾ÍÏñ¸öËÀÑ»·
power(2,3)¡ú2 * power(2,3)¡ú2 * 2 * power(2,3)¡ú ...
Ìý¶®ÁË£¬¸Ðл´óÀÐ
Ò³:
[1]