下方Python语句的输出结果是()。counter=0; num=0def TestVariable():global counterfor i in range(4):counter+=1num=5TestVariable()print(counter, num)
A. 4 0
B. 10 0
C. 4 5
D. 10 5
查看答案
执行下方代码,其中选项( )在调用函数时会报错。def shownumber(numbers):for n in numbers:print(n)下面哪个在调用函数时会报错() 。
A. shownumber( [2,4,5] )
B. shownumber( 'abcesf' )
C. shownumber( 3.4 )
D. shownumber( (12,4,5) )
以下程序输出的结果是()。def person(name, age, **kw):print('name:', name, 'age:', age, 'other:', kw)person('Jack ', 35, city='Beijing')
A. name: Jack age: 35 other: {'city': 'Beijing'}
B. name: Jack age: 35 other:city='Beijing'
C. name: Jack age: 35 other: ('city': 'Beijing')
D. name: Jack age: 35 other: ('city', 'Beijing')
以下程序输出的结果是()。s = 'ABCDE'def fn(n):if len(n) == 1:return nelse:return n[-1] + fn(n[:-1])print(fn(s))
A. BCDEA
B. ABCDE
C. EDCBA
D. CDEAB
以下程序输出的结果是()。def func(name, age=10, *kw):print(name,end=' ')print(age,end=' ')print(kw)func('zhangsan', 13,14,15)
A. zhangsan 10 (14, 15)
B. zhangsan 13 (14, 15)
C. zhangsan 10 (13, 14, 15)
D. zhangsan 13 (10, 14, 15)