#练习一:*
#练习:
#1.统计一共有多少辆车
#2.又增加了两辆车奥迪和奔驰
#3.删除化妆品
#4.又在五环买了一套房
#5.保时捷替换成比亚迪
stus = {
"menu":
{
"house":['三环','四环','七环'],
"car":{
"日本":["雷克萨斯",'英菲尼迪'],
"中国":['五菱荣光','红旗','比亚迪','宝俊'],
"美国":['福特','凯迪拉克']
},
"化妆品":{
"sk-2":1000,
"YSL":8000
}
},
"xiaoC":{
"money":[1000,5000,8000,800000],
"City":{
"越南":2,
"伊拉克":10,
"韩国":2,
"泰国":3
}
}
}
'''新增两辆车'''
car = stus['menu']['car']
car['德国'] = ['奥迪','奔驰']
print(stus['menu']['car'])
'''统计多少辆车'''
all_count = 0
for c in car.values():
all_count = len(c)+all_count
print('menu总共有%s辆车'%all_count)
'''删除化妆品'''
del stus['menu']['化妆品']
'''在五环新增一套房子'''
house = stus['menu']['house']
house.append('四环')
'''保时捷替换比亚迪'''
rep = stus['menu']['car']['中国'][-2]='保时捷'