首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
课程
专栏·文章
竞赛
搜索
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
在线笔面试、雇主品牌宣传
登录
/
注册
码农后端
获赞
172
粉丝
1
关注
8
看过 TA
32
男
门头沟学院
2024
Java
IP属地:江西
公众号:码农后端,欢迎关注!
私信
关注
拉黑
举报
举报
确定要拉黑码农后端吗?
发布(119)
刷题
码农后端
2022-08-26 15:14
门头沟学院 计算机类
题解 | #数字的十六进制#
print(hex(int(input())))
0
点赞
评论
收藏
转发
码农后端
2022-08-26 14:01
门头沟学院 计算机类
题解 | #使用字典计数#
letter=input() ls=[] ls1=[] for i in letter: ls.append(i) for j in ls: ls1.append(ls.count(j)) print(dict(zip(ls,ls1))) 1.思路: step1:创建两个空列表分别用于储存键和值。 step2:for循环遍历、append()追加、count()计数。 step3:zip()函数将两个列表打包,再用di...
0
点赞
评论
收藏
转发
码农后端
2022-08-26 13:03
门头沟学院 计算机类
2022-08-26
在牛客打卡27天,今天也很努力鸭!
每日监督打卡
0
点赞
评论
收藏
转发
码农后端
2022-08-25 17:37
门头沟学院 计算机类
题解 | #字典新增#
my_dict={'a': ['apple', 'abandon', 'ant'], 'b': ['banana', 'bee', 'become'], 'c': ['cat', 'come'], 'd': 'down'} letter=input() word=input() my_dict[letter]=word print(my_dict) 通过使用新的索引键并为其赋值,可以将项目添加到字典中。
0
点赞
评论
收藏
转发
码农后端
2022-08-25 17:24
门头沟学院 计算机类
题解 | #查字典#
my_dict={'a': ['apple', 'abandon', 'ant'], 'b': ['banana', 'bee', 'become'], 'c': ['cat', 'come'], 'd': 'down'} n=input() for i in my_dict: if n==i: for j in my_dict[i]: print(j,end=' ') 思路:两个循环 外...
0
点赞
评论
收藏
转发
码农后端
2022-08-25 14:11
门头沟学院 计算机类
题解 | #生成字典#
n=input().split() l=input().split() print(dict(zip(n,l))) zip() 函数:用于将可迭代的对象(字典,列表,元组,集合,字符串等)作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表。最后用d = dict(zip(k,v)) # 类型转换。
0
点赞
评论
收藏
转发
码农后端
2022-08-25 13:52
门头沟学院 计算机类
题解 | #喜欢的颜色#
1.代码如下: result_dict={'Allen': ['red', 'blue', 'yellow'],'Tom': ['green', 'white', 'blue'],'Andy': ['black', 'pink']} for i in sorted(result_dict): print(f"{i}'s favorite colors are:") for j in (result_dict[i]): print(j) 2.思路:两个循环 st...
0
点赞
评论
收藏
转发
码农后端
2022-08-25 13:35
门头沟学院 计算机类
2022-08-25
在牛客打卡26天,今天也很努力鸭!
每日监督打卡
0
点赞
评论
收藏
转发
码农后端
2022-08-24 22:50
门头沟学院 计算机类
题解 | #首都#
cities_dict={'Beijing': {'Capital': 'China'}, 'Moscow': {'Capital': 'Russia'}, 'Paris': {'Capital': 'France'}} for i in sorted(cities_dict): for j in sorted(cities_dict[i]): print(f'{i} is the capital of {cities_dict[i][j]}!') 字典中嵌套字典,把握好各层次关系就行。
0
点赞
评论
收藏
转发
码农后端
2022-08-24 17:34
门头沟学院 计算机类
题解 | #姓名与学号#
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 student id is {}."....
0
点赞
评论
收藏
转发
码农后端
2022-08-24 16:37
门头沟学院 计算机类
题解 | #毕业生就业调查#
survey_list=['Niumei', 'Niu Ke Le', 'GURR', 'LOLO'] result_dict={'Niumei': 'Nowcoder','GURR': 'HUAWEI'} for i in survey_list: if i in result_dict: print('Hi, %s! Thank you for participating in our graduation survey!'%i) else: &...
0
点赞
评论
收藏
转发
码农后端
2022-08-24 15:40
门头沟学院 计算机类
题解 | #遍历字典#
operators_dict={'<': 'less than', '==': 'equal'} print('Here is the original dict:') for i in operators_dict: print('Operator %s means %s.'%(i, operators_dict[i])) operators_dict['>']='greater than' print('\nThe dict was changed to:') for j in operators_dict: print(...
0
点赞
评论
收藏
转发
码农后端
2022-08-24 10:58
门头沟学院 计算机类
题解 | #增加元组的长度#
大道至简,一行解决 print(tuple((range(1,6))),len(tuple((range(1,6)))),tuple((range(1,6)))+tuple((range(6,11))),len(tuple((range(1,6)))+tuple((range(6,11)))),sep='\n') >>考点:连接两个或多个元组,可以使用 + 运算符
0
点赞
评论
收藏
转发
码农后端
2022-08-24 10:45
门头沟学院 计算机类
题解 | #名单中出现过的人#
根据题意,用in检验即可。 tp=tuple(['Tom', 'Tony', 'Allen', 'Cydin', 'Lucy', 'Anna']) print(tp) name=input() if name in tp: print('Congratulations!') else: print('What a pity!')
0
点赞
评论
收藏
转发
码农后端
2022-08-24 10:35
门头沟学院 计算机类
题解 | #输出前三同学的成绩#
students=input().split() print(tuple((students))[:3]) 和列表切片一样。注意创建元组要用双括号。
0
点赞
评论
收藏
转发
1
2
3
4
5
6
8
工具箱
TA的圈子
暂未加入圈子
TA的圈子
TA的笔记
暂无笔记
TA的笔记
登录
0
天
已登录
0
天
连续登录
0
人
今日访客
牛客网
牛客企业服务