码农后端
码农后端
全部文章
分类
归档
标签
去牛客网
登录
/
注册
码农后端的博客
全部文章
(共57篇)
题解 | #遍历字典#
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
题解 | #增加元组的长度#
大道至简,一行解决[笑cry] 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,...
2022-08-24
0
221
题解 | #名单中出现过的人#
根据题意,用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.根据题意写出代码: entry_form=tuple(('Niuniu','Niumei')) print(entry_form) try: entry_form[1]='Niukele' except TypeError: prin...
Python3
2022-08-24
9
396
题解 | #运动会双人项目#
~代码如下: name1=input() name2=input() print(tuple((name1,name2))) ~注意创建要双括号。
Python3
2022-08-23
0
243
题解 | #跳过列表的某个元素#
简单,根据题目说的来就行。 for i in range(1,16): if i==13: continue else: pr...
Python3
2022-08-22
0
282
题解 | #提前结束的循环#
一看到for循环,就想用range(),一遇到列表,就想用len()。[笑cry] x=int(input()) ls=[3, 45, 9, 8, 12, 89, 103, 42, 54, 79] for i in range(len(ls)): if x==ls[...
Python3
2022-08-22
0
261
题解 | #找到HR#
代码如下: users_list=['Niuniu', 'Niumei', 'HR', 'Niu Ke Le', 'GURR', 'LOLO' ] for name in users_list: if name=='HR' : &nbs...
Python3
2022-08-22
0
233
题解 | #格式化清单#
代码如下: list=['apple', 'ice cream', 'watermelon', 'chips', 'hotdogs', 'hotpot'] i=0 while i<len(list): list.pop() prin...
2022-08-22
0
206
首页
上一页
1
2
3
4
5
6
下一页
末页