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

Python一级题目解析

1、题目

作图题:

绘制如下图形:

(1)画一个由一个正方形和一个菱形组成的图形,其中,正方形的边长为200象素,菱形的四个顶点均在正方形四条边的中点上;

(2)设置画笔速度为1;

(3)菱形的填充颜色为红色,所有线条为黑色;

(4)画图结束,隐藏并停止画笔。


2、答案

参考程序:

注意:仅供参考,画法和顺序,考生可以自行设计,结果符合题意即可。

import turtle

turtle.speed(1)
turtle.pencolor(
2021年09月青少年软件编程(Python)等级考试试卷(一级) 试题解析 阅读详情

相关推荐

电子学会 2021年9月 青少年软件编程Python编程等级考试一级真题解析(选择题+判断题+编程题)

电子学会 2021年9月 青少年软件编程Python编程等级考试一级真题解析(选择题+判断题+编程题)

qq_42673622的博客 668

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

青少年软件编程(Python)等级考试试卷(一级) 分数:100.00 题数:37 一、单选题(共25题,每题2分,共50分) 1. 取整除的运算符是?( ) A、 / B、 // C、 ÷ D、** 题型:单选题 答案:B 难度:一般 试题解析:B 2. 下面的程序为海龟绘制正方形的程序,请选择正确选项将程序补全?( ) import turtle turtle.forward(100) turtle.left(90) turtle...

IT_Scratch的博客 7756

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

青少年软件编程(Python)等级考试试卷(一级) 分数:100.00 题数:37 一、单选题(共25题,每题2分,共50分) 1. 下列程序运行的结果是?( ) s = 'hello' print(s+'world') A、sworld B、helloworld C、hello D、world 答案:B 试题解析:s和'world'都属于字符串类型,加法运算表示的是字符串拼接的操作,所以最后得到的答案为helloworld,所以选择B选项。 2....

IT_Scratch的博客 5619

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

青少年软件编程(Python)等级考试试卷(一级) 一、单选题(共25题,共50分) 1. 昨天的温度是5摄氏度,今天降温7摄氏度,今天的温度是多少摄氏度?( ) A. 12 B. 7 C. 2 D. -2 试题编号:20210302-sxw-29 试题类型:单选题 标准答案:D 试题难度:一般 试题解析:负数计算 考生答案:D 考生得分:2 是否评分:已评分 评价描述: 2. 分析下面程序,关于程序说法正确的是?( ) x1="11" x2="12" x..

IT_Scratch的博客 8078

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

青少年软件编程(Python)等级考试试卷(二级) 分数:100.00 题数:37 一、单选题(共25题,每题2分,共50分) 1. 有如下Python程序段: x,y=12,5 if x % y==0: z=x/y print(x,"/",y,"=",z) else: z=y*x print(x,"*",y,"=",z) 程序段执行后,输出的结果为?( ) A、x/y=2.4 B、x*y=60 C、12/5=2....

IT_Scratch的博客 5492

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

青少年软件编程(Python)等级考试试卷(一级) 分数:100.00 题数:37 一、单选题(共25题,每题2分,共50分) 1. 下列哪个操作不能退出IDLE环境?( ) A、Alt+F4 B、Ctrl+Q C、按ESC键 D、exit() 试题编号:20210124-yfj-003 题型:单选题 答案:C 难度:简单 试题解析:太简单 2. print(4 + 8 // 2)的输出结果是?( ) A、6 B、6.0 C、8 D、8.0...

IT_Scratch的博客 5239

2022年9月电子学会青少年编程Python等级考试一级真题解析(Python一级)

2022年9月电子学会青少年编程Python等级考试一级真题解析(Python一级),判断题和编程题

自在逍遥 1190

【电子学会】2020年09月Python一级 -- 编程题37

要求:(1)画一个边长为200的正方形,里面嵌套一个直径为100的圆,如下图;(2)圆的填充颜色为蓝色,所有的线条为黑色。(3)圆心位置为画布正中心。

老马的程序人生 862

2021年09月-电子学会青少年等级考试Python(一级)真题与解析

2021年09月-电子学会青少年等级考试Python(一级)真题与解析

~ 1215

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

青少年软件编程(Python)等级考试试卷(二级) 分数:100.00 题数:37 一、单选题(共25题,每题2分,共50分) 1. 执行下列代码后,运行结果是?( ) seq=['hello','good','morning'] s='*'.join(seq) print(s) A、hello*good*morning* B、*hello*good*morning C、hello*good*morning D、*hello*good*morning* ...

IT_Scratch的博客 3761

2021年06月-电子学会青少年等级考试Python(一级)真题与解析

2021年06月-电子学会青少年等级考试Python(一级)真题与解析

~ 1188

2022年3月电子学会Python等级考试试卷(一级)答案解析

青少年软件编程(Python)等级考试试卷(一级) 分数:100题数:37 一、单选题(共25题,共50分) 1. 已知a="161",b="16",c="8",执行语句d=a>b and a>c,变量d的值为是?( ) A. 0 B. 1 C. True D. False 试题编号:20200310-fjn-007 试题类型:单选题 标准答案:D 试题难度:较难 试题解析:本题考查的是字符串+运算。字符串+表示将后面的字符串拼接在前面的字符串中。 考生答案:C..

IT_Scratch的博客 9192

2021年03月-电子学会青少年等级考试Python(一级)真题与解析

2021年03月-电子学会青少年等级考试Python(一级)真题与解析

~ 1498

使用turtle库函数绘制一个如图所示的,边长为100像素的正方形及一个紧挨四个顶点的圆形(外接圆)

使用turtle库函数绘制一个如图所示的,边长为100像素的正方形及一个紧挨四个顶点的圆形(外接圆)

python电子学会等级考一级模拟试题

python电子学会等级考一级模拟试题

【重磅更新】CT/MRI LI-RADS 2024:肝细胞癌局部区域治疗后反应评估的核心突破与临床实践指南

减少过度治疗:辐射 LRT 的 Nonprogressing 类别避免了 “持续强化 = 存活” 的误判,降低不必要的再治疗风险;提高检出效率:非辐射 LRT 的辅助特征升级减少了 Equivocal 比例,更早识别存活肿瘤;统一评估语言:标准化的分类标准为放射科、肝病科、肿瘤科、肝移植科的多学科协作(MDT)提供了统一 “沟通工具”,助力治疗方案的精准制定。

楚山之石的博客 1238

STM32外围电路硬件解析

复位 :让MCU回到最开始的状态。并且从头开始,重新执行程序 我们什么时候需要复位? 1.烧录的时候 2.程序跑飞了的时候 3.上电复位(上电的时候需要复位) 复位方式: 1.上电复位: --- 一定要有 MCU的Reset是复位引脚,当这个引脚为低电平时,

qq_39577221的博客 1万+

5分钟搞定!用Cursor和.NET 9.0快速搭建串口通讯上位机(附VS Code插件配置)

本文分享了如何利用Cursor AI编程助手与.NET 9.0,在5分钟内快速构建一个功能完整的串口通讯上位机程序。通过自然语言描述需求,AI自动生成WinForms界面和核心代码,极大提升了硬件调试工具的定制开发效率。文章详细介绍了环境配置、AI协作编码、功能实现与调试的全过程。

weixin_28366353的博客 286

OpenCV图像去畸变实战指南:从原理到参数调优(附完整代码与效果对比)

本文深入解析了OpenCV图像去畸变的原理与实战技巧,详细对比了标准透视、鱼眼及全能型omnidir三种校正函数的核心参数调优方法。通过分析alpha、balance、centerX/Y及focalScale四大参数对输出效果的影响,并结合完整代码与效果对比图,帮助开发者精准校正镜头畸变,提升计算机视觉任务精度。

weixin_29046611的博客 344

特斯拉Model 3 BMS主控板拆解:从硬件设计到热管理策略的实战解析

本文深度拆解特斯拉Model 3的BMS主控板,解析其硬件架构与热管理协同策略。文章聚焦于主控板的分区布局、双核MCU的智慧分工,以及从被动监控到主动干预的热管理范式转变,揭示了特斯拉在高压安全、实时控制与系统级工程思维上的设计哲学。

zz67890的博客 604

【调优】OpenClaw从零开始高阶调优之skill篇

本文详细解析了OpenClaw技能系统的核心机制。首先介绍了技能的分层加载逻辑,按照优先级从高到低依次为:工作区专属技能、全局共享技能、出厂自带技能和自定义路径技能。通过流程图展示了从扫描到注册的完整加载流程,并解释了同名技能覆盖规则。随后深入剖析了SKILL.md文件结构,包含YAML元数据定义技能属性和Markdown正文说明使用方法,以公众号写作技能为例展示了具体配置。文章还提供了技能优先级切换的实用技巧,帮助用户灵活管理不同版本的技能。

海兰 252

OpenHarmony电源管理驱动架构剖析:HDI框架下的低功耗实现

鸿蒙电源管理驱动模块是OpenHarmony操作系统中负责设备电源状态管理的核心组件。该模块基于HDI(Hardware Device Interface)框架实现,提供了完整的电源管理功能,包括系统休眠/唤醒、运行锁管理、休眠模式控制等核心功能。public:// 主要接口函数// 运行锁管理private:// 内部辅助函数// 成员变量public:// 运行锁控制接口// 回调管理private:// 内部辅助函数。

m0_67505153的博客 212

光学测量仿真软件:OpticsBuilder_(9).热应力分析与补偿

在OpticsBuilder中,定义材料的热膨胀系数可以通过API进行。以下是一个Python代码示例,展示如何在OpticsBuilder中定义材料的热膨胀系数。

kkchenjj的博客 1090

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

深度学习工具包 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'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('DeepLearnToolbox'));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('state',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'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',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 = 'sigm';%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, 'Too big error');```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('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';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)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';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, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% 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'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 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, 'Too big error');```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('state',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, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',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, 'Too big error');%% ex3 neural net with dropoutrand('state',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, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % 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, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % 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, 'Too big error');%% 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('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % 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, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: 【电子学会】2021年09月Python一级 -- 编程题36
下一篇: 【电子学会】2022年03月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、付费专栏及课程。

余额充值
⌂ 换网址