# 需求1:接收变量 k a b
s = '51 5000 10000'
# a = s.split()
# print(a)
# li = []
# for item in s.split():
# li.append(int(item))
# print(li)
# k,a,b = li
# print(k,a,b)
li = [int(item) for item in s.split()]
print(li)
k, a, b = li
print(k, a, b)
# 需求2:生成一个列表,列表的元素分别为[1**1 2**2 9**9 ]
li = []
for i in range(1, 10):
li.append(i ** i)
print(li)
print([i ** i for i in range(1, 10)])
print([i ** i for i in range(1, 10) if i % 2 == 0])
# 找出1~10之间的所有偶数
print([i for i in range(1,11) if i %2 == 0])
# s1 = 'ABC' s2='123' A1 A2 A3...C1 C2 C3
print([i + j for i in 'ABC' for j in '123'])
文章目录列表生成器列表生成器# 需求1:接收变量 k a bs = '51 5000 10000'# a = s.split()# print(a)# li = []# for item in s.split():# li.append(int(item))# print(li)# k,a,b = li# print(k,a,b)li = [int(item) f...