{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "8711d45d",
   "metadata": {},
   "source": [
    "# 06-12 · Поднять и опустить перо\n",
    "\n",
    "Практика к разделу [«Поднять и опустить перо»](../../site/chapters/glava-06/06-12-pero-vverh-vniz.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e9a0e5b5",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Освоить penup()/pendown() — движение без рисования."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2a3f5521",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f6284e10",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:15.123383Z",
     "iopub.status.busy": "2026-08-16T13:58:15.123227Z",
     "iopub.status.idle": "2026-08-16T13:58:15.315312Z",
     "shell.execute_reply": "2026-08-16T13:58:15.314826Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Окно Turtle готово.\n"
     ]
    }
   ],
   "source": [
    "import turtle\n",
    "\n",
    "screen = turtle.Screen()\n",
    "artist = turtle.Turtle()\n",
    "artist.pensize(3)\n",
    "artist.pencolor(\"#5B24F9\")\n",
    "print(\"Окно Turtle готово.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "63c8036a",
   "metadata": {},
   "source": [
    "## Рабочий пример\n",
    "\n",
    "Линия — пробел — линия."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "06a6e132",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:15.316316Z",
     "iopub.status.busy": "2026-08-16T13:58:15.316202Z",
     "iopub.status.idle": "2026-08-16T13:58:15.548883Z",
     "shell.execute_reply": "2026-08-16T13:58:15.548308Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.reset()\n",
    "artist.forward(60)\n",
    "artist.penup()\n",
    "artist.forward(60)\n",
    "artist.pendown()\n",
    "artist.forward(60)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8a1cc3b3",
   "metadata": {},
   "source": [
    "## Эксперимент 1\n",
    "\n",
    "Проверьте isdown() до и после penup()."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "005cbf48",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:15.549972Z",
     "iopub.status.busy": "2026-08-16T13:58:15.549869Z",
     "iopub.status.idle": "2026-08-16T13:58:15.594089Z",
     "shell.execute_reply": "2026-08-16T13:58:15.593573Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n",
      "False\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "print(artist.isdown())\n",
    "artist.penup()\n",
    "print(artist.isdown())\n",
    "artist.pendown()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "af249fba",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Нарисуйте пунктирную линию из четырёх штрихов по 20 пикселей с промежутками по 20 пикселей (penup между штрихами)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "36951fa5",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:15.595063Z",
     "iopub.status.busy": "2026-08-16T13:58:15.594958Z",
     "iopub.status.idle": "2026-08-16T13:58:15.867511Z",
     "shell.execute_reply": "2026-08-16T13:58:15.867085Z"
    }
   },
   "outputs": [],
   "source": [
    "artist.reset()\n",
    "for _ in range(4):\n",
    "    artist.forward(20)\n",
    "    artist.penup()\n",
    "    artist.forward(20)\n",
    "    artist.pendown()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b850027d",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e307b066",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T13:58:15.868850Z",
     "iopub.status.busy": "2026-08-16T13:58:15.868743Z",
     "iopub.status.idle": "2026-08-16T13:58:15.871622Z",
     "shell.execute_reply": "2026-08-16T13:58:15.871191Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Окно Turtle закрыто.\n"
     ]
    }
   ],
   "source": [
    "screen.bye()\n",
    "print(\"Окно Turtle закрыто.\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Cartesian Python 3.14",
   "language": "python",
   "name": "cartesian-python314"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.14.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
