So I made a few changes to the code, see
if you agree with them. In the draw square function,
I now use a loop, and this loop does my
repetitive tasks, tasks like move the turtle forward and turn it
right, and this loop runs 4 times. Then I created
a new function called draw art, in this function I
create the window screen. This is the screen that has
the background color as red, and then I create my first
turtle, which I named brad. I change brad's shape,
color and speed, and then I call the draw square
function, so that I can actually draw my first
square. After that, I create my second turtle, angie. And
here are angie shape and color, and then angie
draws a circle. And then towards the end, I call
the draw_art function which is right here. So let
me go ahead and save, and run this program to
make sure everything is running fine. And there's our two
turtles. One drawing a square, the other one drawing a circle.
لقد قمت بإجراء بعض التغييرات على التعليمة البرمجية، راجعها
،وحدد ما إذا كنت موافقًا عليها أم لا. في دالة draw_square
أستخدم تكرارًا حلقيًا، وتتمثل مهمة هذا التكرار في تنفيذ
المهام المتكررة، مثل توجيه السلحفاة للأمام وتوجيهها
لليمين، ويتم تشغيل هذا التكرار الحلقي أربع مرات. وبعد ذلك، قمت بإنشاء دالة
جديدة اسمها draw_art، وفي هذه الدالة، يمكنني إنشاء
شاشة النافذة. ويُقصد بها الشاشة التي
تتلون خلفيتها باللون الأحمر، وبعد ذلك سأقوم بإنشاء أول
،سلحفاة، وسأسميها Brad. بعد ذلك، سأقوم بتغيير شكل Brad ولونها
وسرعتها، وبعدها سأستدعي الدالة draw_square
حتى أتمكن من رسم المربع
الأول. سأقوم بعد ذلك بإنشاء السلحفاة الثانية، وسأسميها Angie. وها هو
شكل Angie ولونها، وبعد ذلك، ستقوم Angie
برسم دائرة. وفي النهاية، سأستدعي دالة
draw_art من هنا. دعني
أقوم بمواصل العملية وحفظها وتشغيل البرنامج
للتأكد من أن كل شيء يعمل بشكل جيد. يمكنك الآن رؤية
.السلحفاتين. وترسم إحداهما مربعًا، والأخرى ترسم دائرة
Le hice algunos cambios al código, veamos
si están de acuerdo con ellos. En la función draw_square,
ahora uso un ciclo, y este ciclo hace
mis tareas repetitivas, tareas como mover a la tortuga hacia adelante y girarla
a la derecha, y este ciclo se ejecuta cuatro veces. Luego, creé
una nueva función llamada draw_art. En esta función
creé una pantalla de ventana. Ésta es la pantalla que tiene
el color del fondo como rojo, y luego cree mi primer
turtle, al cual nombre brad. Puedo cambiar la forma,
el color y la velocidad de brad, y luego llamo la función
draw_square, de manera que pueda realmente dibujar mi primer
cuadrado. Después de eso, creo mi segundo turtle, angie. Y
aquí está la forma y el color de angie. Y luego angie
dibuja un círculo. Luego, hacia el final, llamo
la función draw_art que está justo aquí. Bien, permítanme
continuar y guardar, y ejecutar este programa para
asegurarme de que todo se ejecute bien. Y aquí tenemos a nuestros dos
turtles. Uno dibuja un cuadrado y el otro dibuja un círculo.
コードを少し変えました
まずはdraw_square関数の部分です
ループ文を使って
forwardとrightが繰り返されている部分を変えました
ループする回数は4回です
次にdraw_artという関数を作りました
画面を作る関数で背景の色は赤です
そして1つめのTurtleをbradと名づけて
形や色そして速さを設定して
draw_square関数を呼び出します
これで四角を描くことができます
次に2つ目のTurtleであるangieを作ります
angieの形や色を設定し
円を描くように指定します
これでdraw_art関数が完成しました
保存して実行してみましょう
うまく動くか確認します
2つのTurtleのうち1つは四角を
もう1つは円を描きました
Fiz algumas alterações no código, veja
se você concorda com elas. Na função draw_square,
usei um loop para fazer as
tarefas repetitivas, como avançar e virar
à direita, que é executado quatro vezes. Criei
uma nova função chamada draw_art,
e nela criei a tela window. Esta é a tela com o
segundo plano em vermelho. Depois, criei meu primeiro
turtle, que chamei de brad. Altero a forma,
cor e velocidade de brad, e chamo a função draw_square
para que possa desenhar meu primeiro
quadrado. Depois disso, crio angie, meu segundo turtle. Aqui
estão a forma e a cor de angie, que
desenha um círculo. Ao final, chamo
a função draw_art. Vou
salvar e executar este programa para
ter certeza de que está tudo funcionando bem. Pronto, nossos dois
turtles. Um desenha um quadrado e o outro, um círculo.
我给代码做了一些改动
看看你是否认同它们 在画方形函数中
我现在用了一个循环 这个循环可以帮我做
重复的任务 像使乌龟向前移动和转右的任务
这个循环做了四次 然后我创建了
一个新的函数叫 draw art 在这个函数中
我创造了窗口屏幕 这个窗口屏幕的
背景颜色是红色 接着我创建我的第一个
乌龟 我叫它 brad 我改变 brad 的形状
颜色和速度 然后我调用画方形函数
直到我真正可以画出我的第一个方形
然后 我创造了我的第二个乌龟 angie 接着
就是 angie 的形状和颜色 然后 angie
画了一个圆圈 然后朝向终点 我调用
draw_art 函数 它在这里
让我保存一下 然后运行这个程序来
确保一切都运行正常 这里是我们的两个乌龟
一个画一个方形 另一个画了一个圆圈