Please list each element by "_" link up.
users = ['李少奇','李启航','渣渣辉']
Please list each element by "_" link up.
users = ['李少奇','李启航',666,'渣渣辉']
Please tuples v1 = all elements (11,22,33) is added to the list of v2 = [44,55,66] in.
Please tuples v1 = all elements of the even-indexed location (11,22,33,44,55,66,77,88,99) is added to the list of v2 = [44,55,66] in.
The dictionary keys and values added to the key_list and value_list two lists, such as:
key_list = [] value_list = [] info = {'k1':'v1','k2':'v2','k3':'v3'}
字典dic = {'k1': "v1", "k2": "v2", "k3": [11,22,33]}
a. 请循环输出所有的key b. 请循环输出所有的value c. 请循环输出所有的key和value d. 请在字典中添加一个键值对,"k4": "v4",输出添加后的字典 e. 请在修改字典中 "k1" 对应的值为 "alex",输出修改后的字典 f. 请在k3对应的值中追加一个元素 44,输出修改后的字典 g. 请在k3对应的值的第 1 个位置插入个元素 18,输出修改后的字典
Please print each cycle k2 corresponding element values.
info = { 'k1':'v1', 'k2':[('alex'),('wupeiqi'),('oldboy')], }
A character string "k: 1 | k1: 2 | k2: 3 | k3: 4" processed into a dictionary { 'k': 1, 'k1': 2 ....}
write the code
""" 有如下值 li= [11,22,33,44,55,66,77,88,99,90] ,将所有大于 66 的值保存至字典的第一个key对应的列表中,将小于 66 的值保存至第二个key对应的列表中。 result = {'k1':[],'k2':[]} """
Output of goods list, the user enters the serial number, the user selects the display of goods
""" 商品列表: goods = [ {"name": "电脑", "price": 1999}, {"name": "鼠标", "price": 10}, {"name": "游艇", "price": 20}, {"name": "美女", "price": 998} ] 要求: 1:页面显示 序号 + 商品名称 + 商品价格,如: 1 电脑 1999 2 鼠标 10 ... 2:用户输入选择的商品序号,然后打印商品名称及商品价格 3:如果用户输入的商品序号有误,则提示输入有误,并重新输入。 4:用户输入Q或者q,退出程序。 """
Look at the code written results
v = {} for index in range(10): v['users'] = index print(v)
Python fifth day job title
Guess you like
Origin www.cnblogs.com/yuancw/p/11456383.html
Recommended
Ranking