26. 根据要求编写程序,不能照搬课堂练习与作业及书上的原有代码,胡乱拼凑代码得零分!比如在程序中定义了一个颜色列表,但并没有使用到这个列表。
1. 程序至少有20行代码,能够运行无错误。(5分)
2. 用到至少一种循环语句。(5分)
3. 程序至少用到列表或元组。(5分)
4. 能够明确实现某种功能。(5分)
5. 给程序写文字说明,介绍程序的每一段的用途,至少50个字。(5分)
额外分:
如果程序用到了自定义函数,加5分。如果程序运行后富有创意,加5分。
程序的文字说明写到最后,程序在IDLE中调试完毕后粘贴到下面。
以下是学生徐*东的答案:
import turtle t = ['red','yellow','orange','green','cyan','blue','purple'] turtle.left(90) turtle.shape('turtle') turtle.speed(1) turtle.pensize(10) turtle.bgcolor('black') turtle.begin_fill() for x in range(4): turtle.color(t[x]) turtle.fd(50) turtle.rt(90) turtle.fd(50) turtle.left(90) turtle.fd(50) turtle.rt(90) turtle.color('white') turtle.end_fill() turtle.penup() turtle.fd(200) turtle.begin_fill() turtle.pendown() for x in range(4): turtle.color(t[-x]) turtle.fd(50) turtle.rt(90) turtle.fd(50) turtle.left(90) turtle.fd(50) turtle.rt(90) turtle.color('dodgerblue') turtle.end_fill() turtle.penup() turtle.rt(90) turtle.fd(200) e = ['pink','magenta','gold','lime','tomato', 'wheat','wheat','navy','plum','gray'] turtle.begin_fill() turtle.pendown() for x in range(4): turtle.color(e[x]) turtle.fd(50) turtle.rt(90) turtle.fd(50) turtle.left(90) turtle.fd(50) turtle.rt(90) turtle.color('linen') turtle.end_fill() turtle.penup() turtle.fd(-300) turtle.begin_fill() turtle.pendown() for x in range(4): turtle.color(e[-x]) turtle.fd(50) turtle.rt(90) turtle.fd(50) turtle.left(90) turtle.fd(50) turtle.rt(90) turtle.color('tan') turtle.end_fill()
以下是徐*东的文字说明:
我的程序叫四个十字,今年三年级。这个程序首先第一步先导入海龟,再创造一个颜色列表。第二部分确定背景颜色为黑色,速度为最慢,造型为海龟,粗细为10。第三部分首先把颜色变成列表里的颜色,然后循环迭代重复的移动,画出一个十字架,最后填充,后面代码继续重复,最终画出四个不同颜色,不同填充颜色的十字架。
发表评论