NP69. 姓名与学号
描述
输入描述
无输出描述
Python 解法, 执行用时: 10ms, 内存消耗: 2836KB, 提交时间: 2022-06-21
my_dict_1={'name': 'Niuniu','Student ID': 1} my_dict_2={'name': 'Niumei','Student ID': 2} my_dict_3={'name': 'Niu Ke Le','Student ID': 3} dict_list=[] dict_list.append(my_dict_1) dict_list.append(my_dict_2) dict_list.append(my_dict_3) for i in dict_list: #print i print "%s's student id is %d."%(i['name'],i['Student ID'])
Python 解法, 执行用时: 10ms, 内存消耗: 2848KB, 提交时间: 2022-07-22
my_dict_1 = {'name':'Niuniu','Student ID':1} my_dict_2 = {'name':'Niumei','Student ID':2} my_dict_3 = {'name':'Niu Ke Le','Student ID':3} my_dict = [] my_dict.append(my_dict_1) my_dict.append(my_dict_2) my_dict.append(my_dict_3) for i in my_dict: print("{}'s student id is {}.".format(i['name'],i['Student ID']))
Python 解法, 执行用时: 10ms, 内存消耗: 2848KB, 提交时间: 2022-07-17
my_dict_1 = {'name': 'Niuniu','Student ID': 1} my_dict_2 = {'name': 'Niumei','Student ID': 2} my_dict_3 = {'name': 'Niu Ke Le','Student ID': 3} dict_list = [] dict_list.append(my_dict_1) dict_list.append(my_dict_2) dict_list.append(my_dict_3) for i in dict_list: print("%s's student id is %d."%(i['name'],i['Student ID']))
Python 解法, 执行用时: 10ms, 内存消耗: 2848KB, 提交时间: 2022-06-10
a = {"name": "Niuniu", "Student ID": 1} b = {"name": "Niumei", "Student ID": 2} c = {"name": "Niu Ke Le", "Student ID": 3} d = [a, b, c]; for a in d: print("{}'s student id is {}.".format(a["name"], a["Student ID"]));
Python 解法, 执行用时: 10ms, 内存消耗: 2852KB, 提交时间: 2022-07-13
my_dict_1={'name':'Niuniu','Student ID':1} my_dict_2={'name':'Niumei','Student ID':2} my_dict_3={'name':'Niu Ke Le','Student ID':3} dict_list=[] dict_list.append(my_dict_1) dict_list.append(my_dict_2) dict_list.append(my_dict_3) for i in dict_list: print("{0}'s student id is {1}.".format(i["name"],i["Student ID"]))