1.下面代码的执行结果为哪项? 1s1=【1,2,3,4,5] 1s2=[3,4,5,6,7,8]chal =[
for i in 1s2:
if i not in ls1:
chal.append(i)
print(cha1)
○A、(6,7,8)
○B、(1,2,6,7,8)
○C、[1,2,6,7,8]
D、[6,7,8]
1个回答
关注
展开全部
```ls1 = [1, 2, 3, 4, 5]ls2 = [3, 4, 5, 6, 7, 8]chal = []for i in ls2: if i not in ls1: chal.append(i)print(chal)```代码的执行结果为:```[6, 7, 8]```因为在 `ls2` 列表中,只有 6、7、8 这三个数字不在 `ls1` 列表中,所以最终 `chal` 列表中包含了这三个数字。答案选项为 D。
咨询记录 · 回答于2023-06-18
D、[6,7,8]
1.下面代码的执行结果为哪项?
1s1=【1,2,3,4,5]
1s2=[3,4,5,6,7,8]
chal =[
for i in 1s2:
if i not in ls1:
chal.append(i)
print(cha1)
○A、(6,7,8)
○B、(1,2,6,7,8)
○C、[1,2,6,7,8]
1.下面代码的执行结果为哪项?
D、[6,7,8]
○B、(1,2,6,7,8)
break后面没有了吗
print(cha1)
这个问一下
for i in 1s2:
请问这个
1s1=【1,2,3,4,5]
1.下面代码的执行结果为哪项?
D、[6,7,8]
○C、[1,2,6,7,8]
○B、(1,2,6,7,8)
○A、(6,7,8)
print(cha1)
chal.append(i)
if i not in ls1:
for i in 1s2:
chal =[
1s2=[3,4,5,6,7,8]
1s1=【1,2,3,4,5]
1.下面代码的执行结果为哪项?
D、[6,7,8]
○C、[1,2,6,7,8]
○B、(1,2,6,7,8)
○A、(6,7,8)
print(cha1)
chal.append(i)
if i not in ls1:
for i in 1s2:
chal =[
1s2=[3,4,5,6,7,8]
1s1=【1,2,3,4,5]
1.下面代码的执行结果为哪项?
D、[6,7,8]
○C、[1,2,6,7,8]
○B、(1,2,6,7,8)
○A、(6,7,8)
print(cha1)
chal.append(i)
if i not in ls1:
for i in 1s2:
chal =[
1s2=[3,4,5,6,7,8]
1s1=【1,2,3,4,5]
1.下面代码的执行结果为哪项?
D、[6,7,8]
○C、[1,2,6,7,8]
○B、(1,2,6,7,8)
○A、(6,7,8)
print(cha1)
chal.append(i)
if i not in ls1:
for i in 1s2:
chal =[
1s2=[3,4,5,6,7,8]
1s1=【1,2,3,4,5]
1.下面代码的执行结果为哪项?
D、[6,7,8]
○C、[1,2,6,7,8]
○B、(1,2,6,7,8)
○A、(6,7,8)
print(cha1)
chal.append(i)
if i not in ls1:
for i in 1s2:
chal =[
1s2=[3,4,5,6,7,8]
1s1=【1,2,3,4,5]
1.下面代码的执行结果为哪项?
D、[6,7,8]
○C、[1,2,6,7,8]
○B、(1,2,6,7,8)
○A、(6,7,8)
print(cha1)
chal.append(i)
if i not in ls1:
for i in 1s2:
chal =[
1s2=[3,4,5,6,7,8]
1s1=【1,2,3,4,5]
1.下面代码的执行结果为哪项?
D、[6,7,8]
○C、[1,2,6,7,8]
○B、(1,2,6,7,8)
○A、(6,7,8)
print(cha1)
chal.append(i)
if i not in ls1:
for i in 1s2:
chal =[
1s2=[3,4,5,6,7,8]
1s1=【1,2,3,4,5]
1.下面代码的执行结果为哪项?
D、[6,7,8]
○C、[1,2,6,7,8]
○B、(1,2,6,7,8)
○A、(6,7,8)
print(cha1)
chal.append(i)
if i not in ls1:
for i in 1s2:
chal =[
1s2=[3,4,5,6,7,8]
1s1=【1,2,3,4,5]
1.下面代码的执行结果为哪项?
D、[6,7,8]
○C、[1,2,6,7,8]
○B、(1,2,6,7,8)
○A、(6,7,8)
print(cha1)
chal.append(i)
if i not in ls1:
for i in 1s2:
chal =[
1s2=[3,4,5,6,7,8]
1s1=【1,2,3,4,5]
1.下面代码的执行结果为哪项?
D、[6,7,8]
○C、[1,2,6,7,8]
○B、(1,2,6,7,8)
○A、(6,7,8)
print(cha1)
chal.append(i)
if i not in ls1:
for i in 1s2:
chal =[
1s2=[3,4,5,6,7,8]
1s1=【1,2,3,4,5]
1.下面代码的执行结果为哪项?