# 1、有列表['alex',49,[1900,3,18]],分别取出列表中的名字,年龄,出生的年,月,日赋值给不同的变量
info = ['alex',49,[1900,3,18]]
name = info[0]
age = info[1]
day_of_birth = info[2]
print(name,age,day_of_birth)
# 2、用列表的insert与pop方法模拟队列
info = []
info.append("first")
info.append('second')
info.append('third')
print(info)
print(info.pop(0))
print(info.pop(0))
print(info.pop(0))
# 3. 用列表的insert与pop方法模拟堆栈
info = []
info.append("alex")
info.append(49)
info.append("sex")
print(info)
print(info.pop())
print(info.pop())
print(info.pop())
# 5、有如下值集合 [11,22,33,44,55,66,77,88,99,90...],将所有大于 66 的值保存至字典的第一个key中,
#将小于 66 的值保存至第二个key的值中
# 即: {'k1': 大于66的所有值, 'k2': 小于66的所有值}
list1 = [11, 22, 33, 44, 55, 66, 77, 88, 99, 90]
dic1 = {"k1": [], "k2": []}
for iin list1:
if i >66:
dic1["k1"].append(i)
else:
dic1["k2"].append(i)
print(dic1)
# 6、统计s='hello alex alex say hello sb sb'中每个单词的个数
s='hello alex alex say hello sb sb'
s_list = s.split()
s_dict = {}.fromkeys(s_list,0)
for iin s_list:
if iin s_dict:
s_dict[i] +=1
print(s_dict)