【电子学会】2021年09月Python三级 -- 编程题38

Python三级题目解析

1、题目

给定一个整数 num,从 1 到 num 按照下面的规则返回每个数:

如果这个数被 3 整除,返回 ‘Apple’。

如果这个数被 5 整除,返回 ‘Pie’。

如果这个数能同时被 3 和 5 整除,返回 ‘ApplePie’。

如果这个数既不能被 3 也不能被 5 整除,返回这个数字的字符串格式。

n = int(input('请输入一个数字:'))
results = []
for i 
2023年12月青少年软件编程Python等级考试三级真题(含答案) 2023年12月,电子学会,青少年软件编程,Python等级考试,三级真题(含答案) 阅读详情

相关推荐

【电子学会】2023年09月Python三级试卷

已知各个器件原始信息存在列表qj中:qj = [[2, 1], [1, 3], [0, 2], [4, 3], [12, 4], [10, 1], [4, 1]],其中器件信息[2, 1]表示器件送达时间是2,检测时长是1,其他器件信息类推。③qj[j][0]表示送达时间,qj[j][1]则表示的是检测时长,从qj[j][0]==qj[j+1][0]可知此处表示送达时间相同的情况下满足何种条件第j项会和第j-1项交换,显然要比的是检测时间,故而③处填写qj[j][1]>qj[j+1][1]。

老马的程序人生 1998

2021年9月电子学会Python等级考试试卷(五级)考题解析

青少年软件编程(Python)等级考试试卷(五级) 分数:100.00 题数:38 一、单选题(共25题,每题2分,共50分) 1. 执行下列代码,正确的答案是?( ) >>> l=[10,0,1,6,12,8] >>> l.sort(key=str) >>> l A、[0,1,6,8,10,12] B、[0,1,10,12,6,8] C、[0,1,10,6,8,12] D、[12,10,8,6,...

IT_Scratch的博客 5065

2021年12月电子学会Python等级考试试卷(三级)答案解析

需要所有考级相关的资料可以添加我的微信:15570666506 青少年软件编程(Python)等级考试试卷(三级) 分数:100题数:38 总体情况 一、单选题(共25题,共50分) 1. 小明在学习计算机时,学习到了一个十六进制数101,这个十六进制数对应的十进制数的数值是?( ) A. 65 B. 66 C. 256 D. 257 试题编号:20200313-tsn-04 试题类型:单选题 标准答案:D 试题难度:容易 ...

IT_Scratch的博客 2万+

2021年6月电子学会Python等级考试试卷(三级)考题解析

青少年软件编程(Python)等级考试试卷(三级) 分数:100.00 题数:38 一、单选题(共25题,每题2分,共50分) 1. 关于open()函数的参数,下列描述正确的是?( ) A、"w+" 以十六进制格式打开一个文件只用于写入 B、"r+"打开一个文件用于读写。文件指针将会放在文件的末尾 C、"w" 打开一个文件只用于写入。如果该文件已存在则打开文件,并从原有位置开始编辑,即保留原有内容。如果该文件不存在,创建新文件 D、"r" 以只读方式打开文件,文...

IT_Scratch的博客 3万+

python运动数据 青少年编程电子学会python编程等级考试三级真题解析2021年9月

​ python运动数据 2021年9月 python编程等级考试三级编程题 1、编程实现 小文的运动时间数据存储在文件“sport.csv”中,数据内容如下图显示: 下列代码实现了读取数据,求和并统计个数,输出平均时长,并保留2位小数,请你补全代码。 五、考点分析 难度级别:简单,这题相对而言还是有一点小难度,难在文件操作,具体主要考查如下: 分析题目和给定的部分代码,找到给定代码的解题思路 open函数,打开指定的文件 reader函数:读取指定文件里面的内容 list函数:强制将对象转化成

青少年编程学习指导 994

2021年9月电子学会Python等级考试试卷(四级)考题解析

青少年软件编程(Python)等级考试试卷(四级) 分数:100.00 题数:38 一、单选题(共25题,每题2分,共50分) 1. 对于数列3,8,11,15,17,19,25,30,44,采用“二分查找”法查找8,需要查找多少次?( ) A、5 B、4 C、3 D、2 题型:单选题 答案:D 难度:容易 试题解析:按二分查找法的规律,每次先查找中间值,进行比较。 2. 下面哪一项不是pip指令?( ) A、pip install Scipy ...

IT_Scratch的博客 3895

2020年9月电子学会Python等级考试试卷(二级)考题解析

青少年软件编程(Python)等级考试试卷(二级A卷) 分数:100.00 题数:38 一、单选题(共25题,每题2分,共50分) 1. numbers = [1, 11, 111, 9], 运行numbers.sort() 后,运行numbers.reverse() numbers会变成?( ) A、[1, 9, 11, 111] B、[1, 11, 111] C、[111, 11, 9, 1] D、[9111111] 试题编号:20200211-zaq-...

IT_Scratch的博客 2961

【电子学会】2023年05月Python三级试卷

内循环每趟主要从第一个元素开始,相邻元素两两相比,i=1时,j最终取到4,i=2时,j最终取到3,i=3时,j最终取到2,i=2时,j最终取到1,i=1时,j最终取到0,由于range()的终值是取不到的,故第一空应填len(a)-i;16、《孙子算经》是我国古代重要的数学著作,其中有一题:“今有物不知其数,三三数之剩二,五五数之剩三,七七数之剩二,问物几何?24、对一组数据"6, 1, 3, 2, 8"进行排序,按从小到大的顺序进行排列,使用冒泡算法进行编程,则第一轮过后,排序的结果是?

老马的程序人生 671

2020年9月电子学会Python等级考试试卷(一级)考题解析

青少年软件编程(Python)等级考试试卷(一级A卷) 分数:100.00 题数:38 一、单选题(共25题,每题2分,共50分) 1. Python自带的编程环境是?( ) A、PyScripter B、Spyder C、Notepad++ D、IDLE 试题编号:20200205-fjn-01 题型:单选题 答案:D 难度:一般 试题解析: 2. 关于以下代码的说法正确的是?( ) t = int(turtle.textinput('...

IT_Scratch的博客 3952

【电子学会】2022年09月Python三级 -- 编程题38

标准考试答题卡一般采用2B铅笔填涂,填涂好的答题卡经过扫描后得到相应的数字化图像,再通过光学识别,完成答题卡信息数据的采集、分析与统计。计算机判断答题卡中信息点被填涂的标准是灰度值小于132为黑色,灰度值大于等于132为白色。

老马的程序人生 468

【电子学会】2023年03月Python三级试卷

在选择排序中,外循环控制排序趟数,内循环控制排序次数,不难看出,i的取值范围为0~n-2,因此j每次从i的下一个位置开始至最后,故②处填写i+1;若要生成一个由若干小写字母组成的互不重复的随机数组,已知小写字母的ASCII码值为97~122整数范围,并将其进行从小到大输出,如图所示,请将相关程序补充完整。24、在交互式编程环境下,输入 max([(1, 2), (2, 3), (3, 4), (2, 6)]) 语句,执行的结果是?在Python交互式编程环境下执行以下语句,会出现错误的一项是?

老马的程序人生 1355

全国青少年软件编程Python2021年9月(三级卷与答案).docx

全国青少年软件编程Python2021年9月(三级卷与答案)全文共15页,当前为第1页。全国青少年软件编程Python2021年9月(三级卷与答案)全文共15页,当前为第1页。 全国青少年软件编程Python2021年9月(三级卷与答案)全文共15页,当前为第1页。 全国青少年软件编程Python2021年9月(三级卷与答案)全文共15页,当前为第1页。 青少年软件编程(Python)等级考试试卷(三级) 分数:100 题数:38 一、单选题(共25题,每题2分,共50分) 1. 使用map函数可以实现列表数据元素类型的转换,而无需通过循环。则将列表L=['1','3','5','7','9']转换为列表[1,3,5,7,9]的函数写法为?( ) A. map(int,L) B. list(map(int,L)) C. map(L,int) D. list(map(L,int)) 试题编号:20210208-psk-3 试题类型:单选题 标准答案:B 试题难度:较难 试题解析:注意两个点,一个是map的参数为类型、序列。另外,map生成的对象不是列表,需要强制转换。 2. 以下关于l

电子学会Pythonk考级三级历年真题

中国电子学会组织的,全国青少年软件编程等级考试,Python3级的所有题目。自2020年9月~2023年5月,一套不落,手工整理,包括题面和题解答案两个版本,方便查看与打印

基于Plecs的LLC谐振变换器闭环设计:从PI参数整定到动态响应优化

本文详细介绍了在Plecs仿真环境中,如何为半桥LLC谐振变换器设计并优化闭环控制系统。从开环模型搭建与特性分析入手,重点阐述了基于频域法的PI控制器参数整定流程,并通过负载阶跃、输入电压突变等测试优化动态响应。文章还分享了从仿真模型过渡到实际硬件时的关键注意事项,帮助工程师实现稳定、高效的电源设计。

e4f5g6h的博客 623

一种高超声速飞行器弹道的仿真方法

设计并实现了一个高超声速飞行器弹道仿真算法,并应用到基于OSGEarth的态势中。

eyepeak的博客 6542

[官方培训]19-物理模拟 Epic 肖月 笔记

物理引擎全局解算精度的设置,帧率越高,子步越多得到的模拟结果就越精确。引擎默认情况下是以变化的帧率运行的,但是对于Chaos物理引擎来说。一般子步越小,帧率越固定,效果就会更好更稳定一些。图示的分步选项就是依据下方的最长子步时长和最大步数对动态变化的帧率,进一步的做拆分来保证物理效果。对于影视项目建议都开启分步选项。红色框内有三个迭代次数的设置,这是Chaos基于位置的约束求解算法专用的一个设置,可以简单理解为迭代次数越高,当前帧一个子步内得到的结果就越精确。

Tcohneyn的博客 1545

3D视觉-激光三角测量法的概述和原理

激光三角法位移测量的原理是,用一束激光以某一角度聚焦在被测物体表面,然后从另一角度对物体表面上的激光光斑进行成像,物体表面激光照射点的位置高度不同,所接受散射或反射光线的角度也不同,用。激光三角测量法是一种通过图像采集系统采集被测物表面漫反射的激光轮廓,进而基于设备已知的相对位置通过算法处理,获得被测物表面的三维轮廓数据,进而还原目标物体三维空间信息的方法。采用激光三角原理和回波分析原理进行非接触位置、位移测量的精密传感器, 广泛应用于位置、位移 、厚度、半径、形状、振动、距离等几何量的工业测量。

qq_20660115的博客 3919

手把手教你 RT-DETR 添加注意力机制 | 一次性添加 20+ 种!

手把手教你 RT-DETR 添加注意力机制 | 一次性添加 20+ 种!

Coding... 2851

海思芯片OpenHarmony系统移植:Sensor传感器模块HDF驱动配置HCS文件详解

海思系列芯片的传感器模块通过HDF(Hardware Driver Foundation)驱动框架进行管理和配置。传感器HCS(HDF Configuration Source)配置文件定义了各类传感器的硬件参数、总线配置、寄存器序列等信息,为传感器驱动提供必要的初始化和运行参数。海思系列芯片适配OpenHarmony的传感器HDF配置HCS文件是传感器驱动开发的关键部分,通过合理配置可以实现各种传感器设备的驱动支持。

m0_67505153的博客 208

嵌入式Linux&Android开发-环境搭建

目录 一、环境要求 二、相关软件&SDK下载 三、环境安装 3.1 VMware Worksation 3.2 Ubuntu1804 3.3 VSCode安装 3.4 Samba服务器搭建 一、环境要求 编译 Android 对机器的配置要求较高: 64 位 CPU 大于12GB 物理内存+交换内存(最好16GB以上) 30GB 空闲的磁盘空间用于构建,源码树另外占用大约 25GB, 如果要编译源码则还需要 150GB 的磁盘空间。 RK官方推荐使用 Ubuntu 16..

嵌入式成长手册 546

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: 【电子学会】2021年09月Python三级 -- 编程题37
下一篇: 【电子学会】2021年12月Python三级 -- 编程题36
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

青少年编程小助手_Python

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值