二级 Python 简单应用题

高仿模拟练习,turtle 绘图与编程应用,答案点击按钮展开

117简单应用题:turtle 画红色填充正方形

画一个填充红色的边长 100 正方形。color 同时设置笔色和填充色,绘制前后包裹 begin_fill/end_fill。

import turtle
t = turtle.Turtle()
t.color(____)           # 设置颜色:红色
t.____()                # 开始填充
for i in range(4):
    t.forward(100)
    t.left(90)
t.end_fill()
turtle.done()
参考答案
第一处: ''red''
第二处: begin_fill
解析

color(''red'') 设颜色;begin_fill() 开始填充;画完形状后 end_fill() 完成上色。注意引号不要丢。

试题及答案仅供练习参考,不保证完全准确,正式考试请以NCRE官方教材及官方内容为准。

©2026 NCRE二级题库 版权所有