以下代码输出结果为:def sq(func, x):y = x**2return func(y)def f(x):return x**2calc = sq(f, 2)print(calc)
A. 4
B. 8
C. 16
D. 出错,没有输出
查看答案
已知以下函数定义,请问执行函数调用always_sunny(('cloudy'), ('cold',))的结果为:def always_sunny(t1, t2):""" t1, t2 are non empty """sun = ("sunny","sun")first = t1[0] + t2[0]return (sun[0], first)
A. ('sunny', 'ccold')
B. ('sunny', 'cc')
C. ('sunny', 'cloudycold')
D. ( 'cloudy','cold')
执行以下代码后,L中的数据为:L = ["life", "answer", 42, 0]for thing in L:if thing == 0:L[thing] = "universe"elif thing == 42:L[1] = "everything"
A. ['life', 'answer', 42, 0]
B. ['universe', 'answer', 42, 0]
C. ['life', 'everything', 42, 0]
D. ['universe', 'everything', 42, 0]
执行一下代码后,L3的值为:L1 = ['re']L2 = ['mi']L3 = ['do']L4 = L1 + L2L3.extend(L4)L3.sort()del(L3[0])L3.append(['fa','la'])
A. ['mi', 're', ['fa', 'la']]
B. ['mi', 're', 'fa', 'la']
C. ['re','mi', ['fa', 'la']]
D. ['do','mi', ['fa', 'la']]
执行以下代码后,brunch的值为()。L1 = ["bacon", "eggs"]L2 = ["toast", "jam"]brunch = L1L1.append("juice")brunch.extend(L2)
A. ['bacon', 'eggs', 'toast', 'jam']
B. ['bacon', 'eggs', 'juice', 'toast', 'jam']
C. ['bacon', 'eggs', 'juice', ['toast', 'jam']]
D. ['bacon', 'eggs', ['toast', 'jam']]