简答题 偏难
#17911

词频统计 【题目描述】 在文本处理中,统计单词出现的频数是一个常见的任务。 默认小猫角色和白色背景,给定 10 个单词存储在列表 list 中,请你找出其中出现…

词频统计

【题目描述】

在文本处理中,统计单词出现的频数是一个常见的任务。

默认小猫角色和白色背景,给定 10 个单词存储在列表 list 中,请你找出其中出现次数最多的单词存在 result 变量中(确保出现次数最多的单词只有一个)。

例如:list = [Coconut, Coconut, Apple, Lime, Coconut, Apple, Lime, Orange, Banana, Kiwi]

出现次数最多的单词 result = Coconut

【输入描述】

新建列表“list”,用于存储单词。

如下图所示:

【输出描述】

新建变量“result”,用于存储结果。

如下图所示:

【输入样例】

list = [Coconut, Coconut, Apple, Lime, Coconut, Apple, Lime, Orange,

Banana, Kiwi]

【输出样例】

result = Coconut

【输入样例】list = [Lemon, Lemon, Mango, Cherry, Cherry, Grape, Banana, Lemon, Orange,

Mango]

【输出样例】

result = Lemon

注意事项:

1、 变量名的拼写(包括大小写)要和题目完全一致。

2、 输出结果存放在对应变量中即可,无需使用“说…”或“说…,2 秒”积木块

3、 列表直接用“+”功能赋值进行测试即可,无需写代码赋值。

未登录也能判分,登录后才会记录
答案与解析
正确答案:<p><strong><span style=";font-size:16px;font-family:'宋体';color:#000000">【参考程序】</span></strong></p><p><img height="510" src="/codeimages/20253GESP_Scratch4/ans17911_1.png" style="width: 324px; height: 510px;" width="324"/></p><span class="edui-editor-imagescale-hand0" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: nw-resize; top: 0px; margin-top: -4px; left: 0px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand1" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: n-resize; top: 0px; margin-top: -4px; left: 177.5px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand2" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: ne-resize; top: 0px; margin-top: -4px; left: 355px; margin-left: -3px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand3" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: w-resize; top: 332.5px; margin-top: -4px; left: 0px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand4" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: e-resize; top: 332.5px; margin-top: -4px; left: 355px; margin-left: -3px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand5" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: sw-resize; top: 665px; margin-top: -3px; left: 0px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand6" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: s-resize; top: 665px; margin-top: -3px; left: 177.5px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand0" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: nw-resize; top: 0px; margin-top: -4px; left: 0px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand1" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: n-resize; top: 0px; margin-top: -4px; left: 180.5px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand2" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: ne-resize; top: 0px; margin-top: -4px; left: 361px; margin-left: -3px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand3" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: w-resize; top: 337.5px; margin-top: -4px; left: 0px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand4" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: e-resize; top: 337.5px; margin-top: -4px; left: 361px; margin-left: -3px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand5" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: sw-resize; top: 675px; margin-top: -3px; left: 0px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand6" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: s-resize; top: 675px; margin-top: -3px; left: 180.5px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand0" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: nw-resize; top: 0px; margin-top: -4px; left: 0px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand1" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: n-resize; top: 0px; margin-top: -4px; left: 184.5px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand2" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: ne-resize; top: 0px; margin-top: -4px; left: 369px; margin-left: -3px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand3" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: w-resize; top: 340.5px; margin-top: -4px; left: 0px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand4" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: e-resize; top: 340.5px; margin-top: -4px; left: 369px; margin-left: -3px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand5" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: sw-resize; top: 681px; margin-top: -3px; left: 0px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><span class="edui-editor-imagescale-hand6" style='--tw-shadow: 0 0 #0000; --tw-ring-inset: ; --tw-ring-offset-width: 0rem; --tw-ring-offset-color: #fff; --tw-ring-color: rgba(59, 130, 246, 0.5); --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000; box-sizing: inherit; outline: 0px; position: absolute; width: 6px; height: 6px; overflow: hidden; font-size: 0px; display: block; background-color: #3C9DD0; cursor: s-resize; top: 681px; margin-top: -3px; left: 184.5px; margin-left: -4px; color: #34495E; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", 微软雅黑, Arial, sans-serif;'></span><p><img height="380" src="/codeimages/20253GESP_Scratch4/ans17911_2.png" style="width: 348px; height: 380px;" width="348"/></p>
这道题暂未补解析。