单选题 适中
#4378

运行下列程序,输出的结果是?( ) def Pell ( n ) : if n == 1 : return 1 if n == 2 : return 2 if…

运行下列程序,输出的结果是?( )

def Pell(n):
    if n==1:
        return 1
    if n==2:
        return 2
    if n>=3:
        return 2*Pell(n-1)+Pell(n-2)
print(Pell(4))


未登录也能判分,登录后才会记录
答案与解析
正确答案:A
解析

按照程序逻辑为12。