#程序1 def eat _peach (day): s=1 for i in range (9,day-1,-1): s=(s+1)*2 return s print (eat _peach (1)) | #程序2 def eat _peach (day): if day==10: return 1 else: return (eat _peach (day+1)+1)*2 print (eat _peach (1)) |
A.程序1和程序2的输出结果相同,均为第1天的桃子数量 |
B.程序2使用递归算法,函数eat _peach的调用次数为10次 |
C.将程序1的划线语句修改为range (day,10),输出结果发生改变 |
D.将程序2的划线语句修改为print (eat _peach (8)),输出的结果为10 |

同类型试题

y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2


y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2

