Austin_zhai
Austin_zhai
全部文章
分类
题解(18)
归档
标签
去牛客网
登录
/
注册
Austin_zhai的博客
全部文章
(共54篇)
题解 | #球的体积与表面积#
导入math模块,创建接收输入并进行分割 import math r = input() list_r = r.split(' ') 定义两个函数ball_volume和ball_area def ball_volume(radius): v = round(4 / 3 * math.p...
Python3
2022-06-29
0
344
题解 | #牛牛学字母#
创建input接收输入并创建一个空字典 s = input() dict_a = {} 使用for循环将输入字符串的字母和出现次数变为键和值 for i in range(len(s)): dict_a[s[i]] = s.count(s[i]) 使用for循环遍历字典将对应的键和值打印...
Python3
2022-06-29
6
342
题解 | #九九乘法表#
创建交互输入数字 num = int(input()) 使用for循环进行两个数字的相乘操作 for i in range(1, num+1): for m in range(i): m += 1 # 这里也可以在第二个for循环中使用(1, i+1)进行替换...
Python3
2022-06-28
0
291
题解 | #密码游戏#
创建交互接收变量与空列表num, new_list num = input() new_list = list() 将四位数字用for循环遍历拆分进行加密算法操作 for i in range(len(num)): a = (int(num[i]) + 3) % 9 new_lis...
Python3
2022-06-27
0
241
题解 | #拯救被污染的字符串#
创建被污染的字符串 my_str = 'I am$ N$iuniu$, an$d I $am stu$dying in $Now$coder!' 进行特定字符的分割 my_list = my_str.split('$') 根据要求进行打印与拼接 print(my_list) print(''.j...
Python3
2022-06-24
0
242
题解 | #梦想的大学#
创建空字典survey_dict survey_dict = {} 创建死循环并进行信息交互 while True: print('If you have the chance, which university do you want to go to most?') print...
Python3
2022-06-24
0
322
题解 | #牛牛的朋友#
创建列表friends_list friends_list = ['Niu Ke Le', 'Niumei', 'Niuneng', 'GOLO'] 创建replace函数 def replace(friends_list, index): friends_list[index] = in...
Python3
2022-06-24
0
245
题解 | #喜欢的颜色#
创建字典result_dict result_dict = { 'Allen': ['red', 'blue', 'yellow'], 'Tom': ['green', 'white', 'blue'], 'Andy': ['black', 'pink'] } 使用两次fo...
Python3
2022-06-23
26
634
题解 | #遍历字典#
创建字典operators_dict operators_dict = {'<': 'less than', '==': 'equal'} 遍历排序后的字典进行信息打印 print('Here is the original dict:') for m, n in sorted(operat...
Python3
2022-06-23
10
471
题解 | #食堂点餐#
创建订单记录 order_list = ['rice', 'beef', 'chips', 'pizza', 'pizza', 'yogurt', 'tomato', 'rice', 'beef'] 初始化总计金额 total = 0 创建函数order_handle以供后续复用 def ord...
Python3
2022-06-23
0
256
首页
上一页
1
2
3
4
5
6
下一页
末页