Cheno>_<o
Cheno>_<o
全部文章
题解
归档
标签
去牛客网
登录
/
注册
Cheno>_<o的博客
全部文章
/ 题解
(共42篇)
题解 | #查字典#
解题方法 方法1 # 创建fruit number列表, 分别表示牛客水果店各种水果的数量 fruit = ['apple', 'banana', 'strawberry', 'orange', 'mango', 'grape', 'blueberry'] number = [1, 3, 5, 6,...
Python3
2022-06-24
0
433
题解 | #字符类型计数#
方法1 # 输入一行字符串 str = str(input()) # 创建 alpha_num,digit_num,space_num,other_num记录字母、数字、空格、其他字符的个数 alpha_num = 0 digit_num = 0 space_num = 0 other_num =...
Python3
2022-06-24
7
400
题解 | #牛牛的绩点#
# 创建 grade 和 score 列表,存储每次输入的课程等级和学分 grade = [] score = [] # 创建 total_score变量,记录所有的课程的学分 total_score = 0 # 创建 result,记录每门课学分乘上单门课绩点的结果 result = 0 #...
Python3
2022-06-24
19
1388
题解 | #报数游戏#
# 输入m,n n = int(input()) m = int(input()) # 创建n_list列表,记录每个人所在的位置 n_list = list(range(1,n+1)) # 创建out_list列表,用于记录退出的人所在位置 out_list = [] while len(n_...
Python3
2022-06-23
7
467
题解 | #判断素数#
while 1: n = int(input()) if(n>2): break print("请输入一个正整数n,n>2") # 素数即除了1和自身,没有别的因数 flag = True for i in range(2,n): if ...
Python3
2022-06-23
3
502
题解 | #九九乘法表#
n = int(input()) for row in range(1,n+1): for col in range(1,row+1): print(f'{row}*{col}={row*col}',end=' ') print('')
Python3
2022-06-23
0
281
题解 | #栈和队列的实现#
stack = [] list1 = [] # 首先输入两个数字 a = int(input()) b = int(input()) # 分别按照栈和队列的形式进入两个列表 stack.append(a) stack.append(b) list1.append(a) list1.append...
Python3
2022-06-23
1
416
题解 | #密码游戏#
目录名称 我原来的解法 收获 收获1:获取4位整数中各位的数值(更好的方法) 收获2(注意点):通过for循环修改数组中每一项的值 收获3:交换数组中两个元素的位置(更好的方法) 收获4:拼接打印数组中的每个元素(更好的方法) 收获5(注意点):字符串也可以通过for循环遍历,使用str[...
Python3
2022-06-23
283
3743
题解 | #幸运数字的大小#
# 根据输入依次用列表记录三人的幸运数字 num_list = [int(input()),int(input()),int(input())] # 排序 num_list.sort() # 找出其中最小的幸运数字 print(num_list[0]) # 输出列表排序后的结果 print(num_...
Python3
2022-06-23
5
358
题解 | #重复出现的字符串#
while(1): target = input() patten = input() if (target.isalpha()) and (patten.isalpha()): break print("所有字符串都只包含大小写字母") print...
Python3
2022-06-23
0
314
首页
上一页
1
2
3
4
5
下一页
末页