首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
基础学习课
实战项目课
求职辅导课
专栏&文章
竞赛
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
AI面试、笔试、校招、雇品
HR免费试用AI面试
最新面试提效必备
登录
/
注册
775825811
获赞
5
粉丝
2
关注
2
看过 TA
23
门头沟学院
2025
算法工程师
IP属地:湖南
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑775825811吗?
发布(45)
评论
刷题
收藏
775825811
关注TA,不错过内容更新
关注
2024-04-27 21:10
门头沟学院 算法工程师
题解 | #字符子串的查找#
# 没有用find函数、有用例不通过 """ long_str = input().split() if "NiuNiu" in long_str: print(long_str.index("NiuNiu")) else: print(-1) """ # find函数 print(input().find("NiuNiu")) # find函数找得到返回索引,找不到返回-1
0
点赞
评论
收藏
分享
2024-04-27 20:43
门头沟学院 算法工程师
题解 | #列表中第一次出现的位置#
a=input().split() print(a.index('NiuNiu'))
0
点赞
评论
收藏
分享
2024-04-27 20:41
门头沟学院 算法工程师
题解 | #错误出现的次数#
a=input().split() print(a.count('0'))
0
点赞
评论
收藏
分享
2024-04-27 20:40
门头沟学院 算法工程师
题解 | #数学幂运算#
a=input().split() print(pow(int(a[0]),int(a[1]))) print(pow(int(a[1]),int(a[0])))
0
点赞
评论
收藏
分享
2024-04-27 20:36
门头沟学院 算法工程师
题解 | #数字的二进制表示#
print(bin(int(input())))
0
点赞
评论
收藏
分享
2024-04-27 20:35
门头沟学院 算法工程师
题解 | #数字的十六进制#
print(hex(int(input())))
0
点赞
评论
收藏
分享
2024-04-27 20:34
门头沟学院 算法工程师
题解 | #字母转数字#
# mark一下 print(ord(input()))
0
点赞
评论
收藏
分享
2024-04-27 20:30
门头沟学院 算法工程师
题解 | #列表的最值运算#
列表生成式跟map映射尊嘟很厉害 """ l=input().split() num=[int(i) for i in l] # 记得列表生成式!!!!!怎么总是忘记 print(max(num)) print(min(num)) """ # 尝试map映射 l=input().split() num=list(map(int,l)) print(max(num)) print(min(num))
0
点赞
评论
收藏
分享
2024-04-27 20:25
门头沟学院 算法工程师
题解 | #使用字典计数#
mark一下 # 法一 """ code=input() dict={} for i in code: if i in dict: # 需要判断键是否在字典中,才能对值进行相加 dict[i] += 1 else: dict[i] = 1 print(dict) """ # 法二 code=input() dict={} for i in code: x = code.count(i) dict[i] = x print(dict)
0
点赞
评论
收藏
分享
2024-04-27 19:50
门头沟学院 算法工程师
题解 | #查字典#
s=input() dict={'a': ['apple', 'abandon', 'ant'], 'b': ['banana', 'bee', 'become'], 'c': ['cat', 'come'], 'd': 'down'} print(' '.join(dict[s])) # 紧急字符串列表按空格间隔格式输出的函数
0
点赞
评论
收藏
分享
2024-04-27 19:44
门头沟学院 算法工程师
题解 | #生成字典#
mark一下 # zip ()函数用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表.得到列表,将列表转化为字典 # 法一 """ name = input().split() ide = input().split() dict={} for i in zip(name,ide): # zip函数返回的是一个元组列表 dict[i[0]] = i[1] print(dict) """ # 法二 name = input().split() ide = input().split() t = ...
0
点赞
评论
收藏
分享
2024-04-27 18:58
门头沟学院 算法工程师
题解 | #首都#
mark一下,不理解这个题目 """ # 重新整理的字典 cities_dict = {'Beijing':'China','Moscow':'Russia','Paris':'France'} for i in sorted(cities_dict): print(f'{i} is the capital of {cities_dict[i]}!') """ # 典中典 cities_dict = {'Beijing': {'Capital': 'China'}, 'Moscow': {'Capital': 'Russia'}, '...
0
点赞
评论
收藏
分享
2024-04-27 18:37
门头沟学院 算法工程师
题解 | #遍历字典#
operators_dict={'<':'less than','==':'equal'} print('Here is the original dict:') for i in sorted(operators_dict): # 对字典的键进行排序 print(f'Operator {i} means {operators_dict[i]}.') # 输出方式 print() operators_dict['>']='greater than'# 新增字典 print('The dict was changed to:') for i in sorted(operators_d...
0
点赞
评论
收藏
分享
2024-04-26 22:07
门头沟学院 算法工程师
题解 | #增加元组的长度#
# 元组连接可以用加号 m = tuple([i for i in range(1,6)]) n = tuple([i for i in range(6,11)]) print(m,len(m),m+n,len(m+n),sep='\n')
0
点赞
评论
收藏
分享
2024-04-26 21:56
门头沟学院 算法工程师
题解 | #修改报名名单#
# try ... except结构 entry_form = ('Niuniu', 'Niumei') print(entry_form) try: entry_form[1]='Niukele' except TypeError: print('The entry form cannot be modified!')
0
点赞
评论
收藏
分享
1
2
3
创作者周榜
更多
关注他的用户也关注了:
牛客网
牛客网在线编程
牛客网题解
牛客企业服务