# coding: utf-8
age = 16
if age>18:
print("恭喜你成年了!")
else:
print("小朋友未成年哦!!")
age = 16
if age>18:
print("恭喜你成年了!")
else:
print("小朋友未成年哦!!")
2022-07-19
# coding: utf-8
age = 16
if age>18:
print("恭喜你成年了!")
else:
print("小朋友未成年哦!!")
age = 16
if age>18:
print("恭喜你成年了!")
else:
print("小朋友未成年哦!!")
2022-07-19
# Enter a code
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)
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)
2022-07-19
T = (1, 'CH', [3, 4])
L = list(T)
L[2] = tuple(L[2])
t = tuple(L)
print(t)
L = list(T)
L[2] = tuple(L[2])
t = tuple(L)
print(t)
2022-07-18
s1 =set([1, 2, 3, 4, 5])
s2 = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
for i in s2.copy():
if i not in s1:
s2.remove(i)
continue
print(s2)
s2 = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
for i in s2.copy():
if i not in s1:
s2.remove(i)
continue
print(s2)
2022-07-17
d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
na=['Alice', 'Bob', 'Candy', 'Mimi', 'David']
for i in na:
if i in d:
print('{}:{}'.format(i,d.get(i)))
else:
print('{}:none'.format(i))
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
na=['Alice', 'Bob', 'Candy', 'Mimi', 'David']
for i in na:
if i in d:
print('{}:{}'.format(i,d.get(i)))
else:
print('{}:none'.format(i))
2022-07-17
L = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
L.pop(2)
L.pop(2)
print(L)
L.pop(2)
L.pop(2)
print(L)
2022-07-15
names = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
names.append('Gen')
names.insert(-1, 'Phoebe')
names.append('Zero')
print(names)
names.append('Gen')
names.insert(-1, 'Phoebe')
names.append('Zero')
print(names)
2022-07-14
L = ['Alice', 66, 'Bob', True, 'False', 100]
num = 0
while num <= 6:
if num%2 == 1:
print( L[num] )
num = num + 1
num = 0
while num <= 6:
if num%2 == 1:
print( L[num] )
num = num + 1
2022-07-14
# coding: utf-8
s1 = '这是一句中英文混合的Python字符串:'
s2 = 'Hello World!'
print(s1)
print(s2)
s1 = '这是一句中英文混合的Python字符串:'
s2 = 'Hello World!'
print(s1)
print(s2)
2022-07-12