{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "3b3cd01b",
   "metadata": {},
   "source": [
    "# 11-05 · Мини-проект — разноцветная звезда\n",
    "\n",
    "Практика к разделу [«Мини-проект — автоматическая разноцветная звезда»](../../site/chapters/glava-11/11-05-mini-proekt-zvezda.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1c362c96",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Список цветов + Turtle."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b5b6ca5f",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "5f7b80f6",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:40.589074Z",
     "iopub.status.busy": "2026-08-14T20:55:40.588854Z",
     "iopub.status.idle": "2026-08-14T20:55:40.777667Z",
     "shell.execute_reply": "2026-08-14T20:55:40.777231Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Окно Turtle готово.\n"
     ]
    }
   ],
   "source": [
    "import turtle\n",
    "\n",
    "screen = turtle.Screen()\n",
    "artist = turtle.Turtle()\n",
    "artist.speed(0)\n",
    "print(\"Окно Turtle готово.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a7449b1f",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "342f7561",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:40.778831Z",
     "iopub.status.busy": "2026-08-14T20:55:40.778707Z",
     "iopub.status.idle": "2026-08-14T20:55:42.475749Z",
     "shell.execute_reply": "2026-08-14T20:55:42.475044Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Звезда готова, лучей: 5\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "cveta = [\"red\", \"orange\", \"yellow\", \"green\", \"blue\"]\n",
    "\n",
    "for cvet in cveta:\n",
    "    artist.pencolor(cvet)\n",
    "    artist.forward(150)\n",
    "    artist.right(144)\n",
    "\n",
    "artist.pencolor(\"black\")\n",
    "print(\"Звезда готова, лучей:\", len(cveta))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8bbdb837",
   "metadata": {},
   "source": [
    "## Задание ★★ Самостоятельная задача\n",
    "\n",
    "Добавьте ещё цвета в список — проверьте, что звезда автоматически подстраивается."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d22b7e9b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:42.477609Z",
     "iopub.status.busy": "2026-08-14T20:55:42.477384Z",
     "iopub.status.idle": "2026-08-14T20:55:44.838898Z",
     "shell.execute_reply": "2026-08-14T20:55:44.838455Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Звезда с 7 лучами готова.\n"
     ]
    }
   ],
   "source": [
    "artist.reset()\n",
    "cveta = [\"red\", \"orange\", \"yellow\", \"green\", \"blue\", \"purple\", \"pink\"]\n",
    "\n",
    "for cvet in cveta:\n",
    "    artist.pencolor(cvet)\n",
    "    artist.forward(150)\n",
    "    artist.right(144)\n",
    "\n",
    "artist.pencolor(\"black\")\n",
    "print(\"Звезда с\", len(cveta), \"лучами готова.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "68f2e440",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "336833d4",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:44.839908Z",
     "iopub.status.busy": "2026-08-14T20:55:44.839797Z",
     "iopub.status.idle": "2026-08-14T20:55:44.843278Z",
     "shell.execute_reply": "2026-08-14T20:55:44.842804Z"
    }
   },
   "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
}
