x=(3 for i in range(5)) print(list(x)) 结果是
A: [3,3,3,3,3]
B: []
A: [3,3,3,3,3]
B: []
举一反三
- 对于生成器对象x=(3 for i in range(5)),连续两次执行list(x)的结果是一样的
- 1/5 下列代码的运行结果是?for i in range(3):print('i') A: i i i B: 0 1 2 C: 1 2 3 D: 3 3 3
- set1 = {x for x in range(10) if x%2!=0} print(set1) 以上代码的运行结果为? A: {1, 3, 5, 7, 9} B: {1, 3, 5, 7} C: {3, 5, 7, 9} D: {3, 5, 7}
- 语句()会输出1、2、3三个数字。 A: for a in range(3):<br/>print(a) B: i=1<br/>while<br/>i<3:<br/>print(i)<br/>i+=1 C: aList=[1,2,3]<br/>for<br/>i in range(3):<br/>print(aList[i]) D: alist=[2,1,1,6,2,3,5,3,1,7]<br/>for<br/>x in alist[-3::-3]:<br/>print(x)
- 以下程序的输出结果是:list = ["1","3" ,"5"]def app(x):list. append(x)app( "7" )print( list)} A: ['1','3','5'] B: ['1','3','5','7'] C: ['7'] D: "1,3,5,7"