# Enter a code
def classmate(**kwargs):
for i in range(0,len(kwargs.get('names'))):
print('{} ,{} ,{}'.format(kwargs.get('names')[i],kwargs.get('gender')[i],kwargs.get('age')[i]))
classmate(names = ['Alice', 'Bob', 'Candy'], gender = ['girl', 'boy', 'girl'], age = [16, 17, 15])
def classmate(**kwargs):
for i in range(0,len(kwargs.get('names'))):
print('{} ,{} ,{}'.format(kwargs.get('names')[i],kwargs.get('gender')[i],kwargs.get('age')[i]))
classmate(names = ['Alice', 'Bob', 'Candy'], gender = ['girl', 'boy', 'girl'], age = [16, 17, 15])
2023-07-16
def greet(x=None):
if x != None:
print("Hello,World")
else:
print('hello')
s1=greet(22)
print(s1)
if x != None:
print("Hello,World")
else:
print('hello')
s1=greet(22)
print(s1)
2023-07-15
可以這樣就行了
def fact(n):
if n==1:
return 1
return n + fact(n - 1)
s2 =fact(100)
print(s2)
def fact(n):
if n==1:
return 1
return n + fact(n - 1)
s2 =fact(100)
print(s2)
2023-07-15
>>> print(r'''"To be,or not to be":that is the question.
... Whether it's nobler in the mind to suffer.''')
"To be,or not to be":that is the question.
Whether it's nobler in the mind to suffer.
>>>
... Whether it's nobler in the mind to suffer.''')
"To be,or not to be":that is the question.
Whether it's nobler in the mind to suffer.
>>>
2023-07-14
s='special string:(該重復(fù)符號(hào)了,用\隔開(kāi))\',",(又該重復(fù)\符號(hào)了)\\(表示\本身),(又和\\重復(fù)了)\\\\(兩個(gè)本身),(又重復(fù)\)\\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
已采納回答 / Danny_L
def my_sumA(a):? ? cc = 100? ? s=1? ? ? ? ? ? ?? ? while a < cc:? ? ? ? a += 1? ? ? ? s=s+a? ? return sprint(my_sumA(1))
2023-07-02
d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
s = d.keys()
a = input("輸入你要?jiǎng)h除的名字:")
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("輸入你要?jiǎng)h除的名字:")
if a in s:
d.pop(a)
print(d)
else:
print("你輸入的名字不存在")
2023-06-30