L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
S = set([1, 3, 5, 7, 9, 11])
for a in L:
if a in S:
L.remove(a)
else :
continue
S.update(L)
print(S)
print(L)
S = set([1, 3, 5, 7, 9, 11])
for a in L:
if a in S:
L.remove(a)
else :
continue
S.update(L)
print(S)
print(L)
2020-09-18
这个代码不可以,因为L.pop(2)之后Candy出去了,现在要退学的David是在第二个位置,所以下一个位置还是需要pop(2)
2020-09-18
# Enter a code
# -*- encoding:utf-8 -*-
width=1.57
height=3.14
m3=width*height
m3=round(m3,3)
print("长方形的面积为"+str(m3))
# -*- encoding:utf-8 -*-
width=1.57
height=3.14
m3=width*height
m3=round(m3,3)
print("长方形的面积为"+str(m3))
2020-09-18
最赞回答 / 慕的地7124281
一个等号“=”代表的含义是赋值,将某一i值赋给某个变量,比如a=13,就是将13这个数值赋予给a。两个等号“==”判断是否相等,返回True或False,比如1==1,它们相等那么就返回True。1==2,它们是不相等的,那么就返回False。此外,我认为0~1000以内应该包含1000,所以是while num <= 1000:才对
2020-09-18
最新回答 / 慕莱坞6184545
你好,MacBookpro 按照上面的教程安装homebrew的时候提示链接被拒绝,无法继续安装,请问要怎么做呢curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
2020-09-17
# Enter a code
a="python"
print("hello,",a or "world")
b=""
print("hello,", b or "world")
#在计算a or b时,如果 a 是 True,则根据或运算法则,整个计算结果必定为 True,因此返回 a;如果 a 是 False,则整个计算结果必定取决于 b,因此返回 b
a="python"
print("hello,",a or "world")
b=""
print("hello,", b or "world")
#在计算a or b时,如果 a 是 True,则根据或运算法则,整个计算结果必定为 True,因此返回 a;如果 a 是 False,则整个计算结果必定取决于 b,因此返回 b
2020-09-15
ch是在for循环中定义的,意思是把字符串s中的每一个元素依次赋值给ch,然后再把ch打印出来,直到打印出字符串s的最后一个字符为止。
2020-09-15
最赞回答 / 白小九
hello 对应 {0},short 对应 {1},python 对应 {2}。hello 对应 {0},short 对应 {1}, python 对应 {2}你 temp3 里没有 {0},自然就不会打印 hello,建议改成:<...code...>
2020-09-14