执行以下程序后,x的值是x=0for i in range(3):x+=1for j in range(3):if(j):continuex+=1
A: 12
B: 9
C: 6
D: 3
A: 12
B: 9
C: 6
D: 3
举一反三
- 执行以下程序之后x的值为()x=0for i in range(3):x+=1for j in range(3):if(j):continuex+=1print(x) A: 3 B: 6 C: 9 D: 12
- x = 0for i in range(3): x+=1 for j in range(3): if(j): continue x+=1print(x)
- 执行以下程序后,x的值是多少 x = 0 for i in range(3): x += 1 for j in range(3): if (j): continue x += 1
- x = 0for i in range(3): x+=1 for j in range(3): if(j): continue x+=1print(x)输出结果为( )
- 下面说法错误的是( )。知识点:列表推导式 A: dict([(x, x**2) for x in range(6)]) 创建的字典是{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25} B: [[x*3+y for y in range(1,4)] for x in range(3)] 创建的是二维列表 [[1, 2, 3], [4, 5, 6], [7, 8, 9]] C: number = [-2, 4, 6, -5]string = 'ab'z = [(i, j) if i>0 else (-i, j) for i in number for j in string]这段代码创建的列表为[(2, 'a'), (2, 'b'), (4, 'a'), (4, 'b'), (6, 'a'), (6, 'b'), (5, 'a'), (5, 'b')] D: ' '.join([i for i in range(1,11)])的运算结果为字符串'1 2 3 4 5 6 7 8 9 10'