python题

1.

'''
li = [11,22,33,44,55,66,77,88,99,90]
dic = {}
a = []
b = []
for i in li:
if i >= 66:
a.append(i)
if i < 66:
b.append(i)

dic.update(a1=a,b1=b)
print(dic)
'''

2.

'''
li = ['手机','电脑','鼠标垫','游艇']
a = input('请输入商品名称:')
li.append(a)
print(li)
b = int(input("请输入序号:"))
print(li[b])
'''

3.

4.

'''
l1 = [11,22,33]
l2 = [22,33,44]
for i1 in l1:
for i2 in l2:
if i1 == i2:
print(i1)

for i1 in l1:
if i1 not in l2:
print(i1)

for i1 in l2:
if i1 not in l1:
print(i1)

for i1 in l1:
if i1 not in l2:
print(i1)
for i2 in l2:
if i2 not in l1:
print(i2)
'''

5.

'''
s = 'alex'
print(s,type(s))
b = list(s)
print(b,type(b))

s = 'alex'
print(s,type(s))
b = tuple(s)
print(b,type(b))

li = ['alex','seven']
print(li,type(li))
b = tuple(li)
print(b,type(b))

tu = ('Alex','seven')
print(tu,type(tu))
b = list(tu)
print(b,type(b))
'''

posted @ 2020-12-15 18:54  ☀鹏  阅读(69)  评论(0编辑  收藏  举报