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.下面代码的执行结果为哪项?
下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消