Вопрос задан 04.05.2019 в 21:14. Предмет Информатика. Спрашивает Романова Софья.

Как нарисовать цифру 9? На языке програмировании Phyton на черепашек. (Eng versional please).

0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Резник Илья.
#!/usr/bin/env python
# encoding: utf-8

import turtle as T

T.reset()

T.fd(50)    # рисуем нижнюю горизонтальную палочку
T.left(90)
T.fd(100)    # Правая вертикальная
T.left(90)
T.fd(50)    # Верхняя горизонтальная
T.left(90)
T.fd(50)    # Левая вертикальная
T.left(90)
T.fd(50)    # Средняя горизонтальная

T.mainloop()
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

To draw the number 9 using the Python programming language with the turtle module, you can follow these steps:

1. Import the turtle module: ```python import turtle ```

2. Create a turtle object and set its speed: ```python pen = turtle.Turtle() pen.speed(1) ```

3. Move the turtle to the starting position: ```python pen.penup() pen.goto(0, 0) pen.pendown() ```

4. Draw the first curve of the number 9: ```python pen.right(90) pen.circle(30, 180) ```

5. Draw the straight line of the number 9: ```python pen.forward(60) ```

6. Draw the second curve of the number 9: ```python pen.circle(30, 180) ```

7. Hide the turtle: ```python pen.hideturtle() ```

8. Finally, close the turtle graphics window: ```python turtle.done() ```

Putting it all together, here's the complete code to draw the number 9 using the turtle module in Python:

```python import turtle

pen = turtle.Turtle() pen.speed(1)

pen.penup() pen.goto(0, 0) pen.pendown()

pen.right(90) pen.circle(30, 180)

pen.forward(60)

pen.circle(30, 180)

pen.hideturtle()

turtle.done() ```

When you run this code, a turtle graphics window will appear, and you will see the number 9 drawn by the turtle. Feel free to modify the code to customize the appearance of the number 9 in any way you like.

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос