牛客350787991号
牛客350787991号
全部文章
分类
归档
标签
去牛客网
登录
/
注册
牛客350787991号的博客
全部文章
(共63篇)
题解 | #删除好友#
x = input().split() y = input() x.remove(y)#删除x中的y print(x)
2023-09-20
0
216
题解 | #删除简历#
str1 = input().split() del str1[0] print(str1) -------del用于list列表操作,删除一个或者连续几个元素。 # 定义一个list >>> a = [1,2,3,4] >>> a [1,2,3,4]...
2023-09-20
0
281
题解 | #增加派对名单(二)#
x = input().split() y = ['Allen']#把Allen转换成列表 print(y+x) x = input().split() x.insert(0,'Allen') print(x) insert()是列表添加元素的函数并且可以指定位置,insert(指定位置,'要添...
2023-09-20
0
254
题解 | #增加派对名单(一)#
x = input().split() x.append("Allen")#list.append 是没有返回值的 print(x) 如果是在头插入则 y = "Allen"+x
2023-09-20
0
217
题解 | #列表的长度#
x = input().split()#先用split分隔成列表 print(len(x))#在用len计算列表长度
2023-09-20
0
232
题解 | #生成数字列表#
x = input() y = []#创建y空列表 for i in x.split(' '):#取x里面的元素用空格分隔开 y.append(int(i))#把i中的元素取为整数加到空列表y print(y)
2023-09-20
0
263
题解 | #生成列表#
x = input() y = x.split(' ') print(y) name=input() # split() 函数将字符串以空格进行分隔, 括号中不写,默认是所有的空字符,包括空格、换行(\n)、制表符(\t)等。 # split() 函数返回的就是列表形式 name1=name.sp...
2023-09-20
0
200
题解 | #发送offer#
offer_list = ['Allen','Tom'] for i in offer_list:#注意冒号 print ('{}, you have passed our interview and will soon become a member of our company.'.fo...
2023-09-19
0
245
题解 | #截取用户名前10位#
x = input() print(x[0:10]) [:]
2023-09-19
0
237
题解 | #格式化输出(三)#
x = input() print(x.strip()) Python去掉字符串中的空格strip()去掉字符串两边空格lstrip()去掉字符串左边空格rstrip()去掉字符串右边空格eg:复制代码12345678print(name.strip())print(name.lstrip())pr...
2023-09-19
0
258
首页
上一页
1
2
3
4
5
6
7
下一页
末页