# Enter a code
L = ['Alice', 66, 'Bob', True, 'False', 100]
i=0
while i<=5:
if i%2!=0:
print (L[i])
i=i+1
L = ['Alice', 66, 'Bob', True, 'False', 100]
i=0
while i<=5:
if i%2!=0:
print (L[i])
i=i+1
2020-09-09
參考答案有問題吧,應(yīng)該是
hello='Hello'
space=' '
world='World'
print(hello+space +world)
hello='Hello'
space=' '
world='World'
print(hello+space +world)
2020-09-09
L = ['Alice', 66, 'Bob', True, 'False', 100]
for item in L:
i=L.index(item)
if(i%2)!=0:
print(item)
for item in L:
i=L.index(item)
if(i%2)!=0:
print(item)
2020-09-09
age = 19
if age>=18:
print('adult'+' '+str(age))
if age>=18:
print('adult'+' '+str(age))
2020-09-07
print('special string: \', ", \\, \\\\, \\n, \\t')
2020-09-07
#在頁面編輯Python的話,不怎么支持中文,所以最好添加一coding=utf-8,運(yùn)行的提示還是很好的。
# Enter a code
# coding=utf-8
i = 0
sum = 0
for i in range(0,1000,1):
if i%2 == 0:
# 打印偶數(shù)
print("oss:", i)
i = i + 1
sum = sum + i
continue
# 打印奇數(shù)
print("jss:", i)
print(sum)
# Enter a code
# coding=utf-8
i = 0
sum = 0
for i in range(0,1000,1):
if i%2 == 0:
# 打印偶數(shù)
print("oss:", i)
i = i + 1
sum = sum + i
continue
# 打印奇數(shù)
print("jss:", i)
print(sum)
2020-09-07
s1 = set([1, 2, 3, 4, 5])
s2 = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
print(s1.isdisjoint(s2))
for i in s1:
if i in s2:
print(i)
s2 = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
print(s1.isdisjoint(s2))
for i in s1:
if i in s2:
print(i)
2020-09-06
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
S = set([1, 3, 5, 7, 9, 11])
for i in L:
if i in S:
S.remove(i)
else:
S.add(i)
print(S)
S = set([1, 3, 5, 7, 9, 11])
for i in L:
if i in S:
S.remove(i)
else:
S.add(i)
print(S)
2020-09-06
r'...'表示法不能表示多行字符串,也不能表示包含'和 "的字符串。
2020-09-05