s='special string:(该重复符号了,用\隔开)\',",(又该重复\符号了)\\(表示\本身),(又和\\重复了)\\\\(两个本身),(又重复\)\\n,\\t'
2023-07-14
s1 = set([1, 2, 3, 4, 5])
s2 = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
for intem in s2:
if intem in s1:
s1.isdisjoint("")
else:
print(intem)
s2 = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
for intem in s2:
if intem in s1:
s1.isdisjoint("")
else:
print(intem)
2023-07-14
正解:
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
S = set([1, 3, 5, 7, 9, 11])
n = 0
for a in L:
if a in S:
S.remove(a)
L.pop(n)
n += 1
S.update(L)
print(S)
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
S = set([1, 3, 5, 7, 9, 11])
n = 0
for a in L:
if a in S:
S.remove(a)
L.pop(n)
n += 1
S.update(L)
print(S)
2023-07-13
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
S = set([1, 3, 5, 7, 9, 11])
for i in range(len(L)):
if L[i] in S:
S.remove(L[i])
else:
S.add(L[i])
print(S)
S = set([1, 3, 5, 7, 9, 11])
for i in range(len(L)):
if L[i] in S:
S.remove(L[i])
else:
S.add(L[i])
print(S)
2023-07-12
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
S = set([1, 3, 5, 7, 9, 11])
for i in range(len(L)):
if L[i] in S:
S.remove(L[i])
print(S)
S = set([1, 3, 5, 7, 9, 11])
for i in range(len(L)):
if L[i] in S:
S.remove(L[i])
print(S)
2023-07-12
d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
s = d.keys()
a = input("输入你要删除的名字:")
if a in s:
d.pop(a)
print(d)
else:
print("你输入的名字不存在")
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
s = d.keys()
a = input("输入你要删除的名字:")
if a in s:
d.pop(a)
print(d)
else:
print("你输入的名字不存在")
2023-06-30
def average(*args):
sum = 0
for item in args:
sum = sum + item
if len(args) != 0:
avg = sum / len(args)
print(avg)
else:
print(0)
average()
sum = 0
for item in args:
sum = sum + item
if len(args) != 0:
avg = sum / len(args)
print(avg)
else:
print(0)
average()
2023-06-26