码农后端
码农后端
全部文章
分类
归档
标签
去牛客网
登录
/
注册
码农后端的博客
全部文章
(共44篇)
题解 | #字典新增#
my_dict={'a': ['apple', 'abandon', 'ant'], 'b': ['banana', 'bee', 'become'], 'c': ['cat', 'come'], 'd': 'down'} letter=input() word=input() my_dict[le...
Python3
2022-08-25
11
742
题解 | #查字典#
my_dict={'a': ['apple', 'abandon', 'ant'], 'b': ['banana', 'bee', 'become'], 'c': ['cat', 'come'], 'd': 'down'} n=input() for i in my_dict:  ...
Python3
2022-08-25
0
288
题解 | #生成字典#
n=input().split() l=input().split() print(dict(zip(n,l))) zip() 函数:用于将可迭代的对象(字典,列表,元组,集合,字符串等)作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表。最后用d = dict(z...
Python3
2022-08-25
0
269
题解 | #喜欢的颜色#
1.代码如下: result_dict={'Allen': ['red', 'blue', 'yellow'],'Tom': ['green', 'white', 'blue'],'Andy': ['black', 'pink']} for i in sorted(result_dict):...
Python3
2022-08-25
0
263
题解 | #首都#
cities_dict={'Beijing': {'Capital': 'China'}, 'Moscow': {'Capital': 'Russia'}, 'Paris': {'Capital': 'France'}} for i in sorted(cities_dict): &n...
Python3
2022-08-24
0
204
题解 | #姓名与学号#
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=[]...
Python3
2022-08-24
2
381
题解 | #毕业生就业调查#
survey_list=['Niumei', 'Niu Ke Le', 'GURR', 'LOLO'] result_dict={'Niumei': 'Nowcoder','GURR': 'HUAWEI'} for i in survey_list: if i in...
Python3
2022-08-24
0
246
题解 | #遍历字典#
operators_dict={'<': 'less than', '==': 'equal'} print('Here is the original dict:') for i in operators_dict: print('Operator %s mean...
Python3
2022-08-24
0
269
题解 | #名单中出现过的人#
根据题意,用in检验即可。 tp=tuple(['Tom', 'Tony', 'Allen', 'Cydin', 'Lucy', 'Anna']) print(tp) name=input() if name in tp: print('Congratulation...
Python3
2022-08-24
0
268
题解 | #输出前三同学的成绩#
students=input().split() print(tuple((students))[:3]) 和列表切片一样。注意创建元组要用双括号。
Python3
2022-08-24
0
295
首页
上一页
1
2
3
4
5
下一页
末页