胖小妹
胖小妹
全部文章
分类
归档
标签
去牛客网
登录
/
注册
胖小妹的博客
全部文章
(共38篇)
题解 | #牛牛的加减器#
x = int(input()) y = int(input()) print(x+y) print(x-y)
2022-08-03
0
230
题解 | #用列表实现队列#
#初始化列表 queue = [1, 2, 3, 4, 5] #使用pop函数去除队首元素 queue.pop(0) print(queue) #使用pop函数去除队首元素 queue.pop(0) print(queue) #使用append函数添加输入元素至队尾,注意input输入是str格式...
Python3
2022-08-02
0
246
题解 | #用列表实现栈#
#创建一个初始列表 stack = [1,2,3,4,5] #使用pop函数删除列表的最后一个值 stack.pop(-1) print(stack) #使用pop函数删除列表的最后一个值 stack.pop(-1) print(stack) #使用append函数添加用户输入(注意:input...
2022-08-02
0
206
题解 | #密码游戏#
#创建一个数组,获取输入的四位数 list1 =int(input()) #获取4位数中每一位的值 first = list1//1000 second = (list1//100)%10 third = (list1//10)%10 fourth = list1 % 10 #创建一个临时数组ar...
Python3
数组
2022-08-02
0
221
题解 | #有序的列表#
#创建一个依次包含字符串'P'、'y'、't'、'h'、'o'和'n'的列表my_list my_list = ['P','y','t','h','o','n'] #使用sorted函数对列表my_list进行临时排序,输出 print(sorted(my_list)) #输出原始列表 print(...
Python3
2022-08-02
68
876
题解 | #淘汰排名最后的学生#
本题是如何使用删除函数 del #del语句可以删除任何位置处的列表元素 remove #remove方法可根据值删除元素如果不知道要删除元素在列表中的位置时可用remove...
Python3
2022-08-01
5
303
题解 | #删除好友#
#新建一个列表存储输入的好友 list1 = input() #列表中字符串以空格间隔 list2 = list1.split(" ") #创建一个对象存储输入删除的好友 name = input() #从列表中删除 list2.remove(name) print(list2)
Python3
2022-07-29
0
271
题解 | #增加派对名单(二)#
list1 = input() #新建一个列表,输入字符串 list2 = list1.split(" ") #字符串以空格间隔 list2.insert(0,"Allen")#插入Allen至首位 print(list2)
2022-07-29
0
218
首页
上一页
1
2
3
4
下一页
末页