{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1140ce8a",
   "metadata": {},
   "source": [
    "# 11-05 · Мини-проект — разноцветная звезда\n",
    "\n",
    "Практика к разделу [«Мини-проект — автоматическая разноцветная звезда»](../../site/chapters/glava-11/11-05-mini-proekt-zvezda.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c743b40a",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Список цветов + Turtle."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2799495e",
   "metadata": {},
   "source": [
    "## Настройка (выполнить один раз)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f50ab6c6",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:45:15.212335Z",
     "iopub.status.busy": "2026-08-17T14:45:15.212223Z",
     "iopub.status.idle": "2026-08-17T14:45:15.400559Z",
     "shell.execute_reply": "2026-08-17T14:45:15.400084Z"
    }
   },
   "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": "8e1304bb",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2e6d88c9",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:45:15.401576Z",
     "iopub.status.busy": "2026-08-17T14:45:15.401467Z",
     "iopub.status.idle": "2026-08-17T14:45:17.117375Z",
     "shell.execute_reply": "2026-08-17T14:45:17.116898Z"
    }
   },
   "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": "7ab829ea",
   "metadata": {},
   "source": [
    "## Задание ★★ Самостоятельная задача\n",
    "\n",
    "Добавьте ещё цвета в список — проверьте, что звезда автоматически подстраивается."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "fb21c999",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:45:17.118535Z",
     "iopub.status.busy": "2026-08-17T14:45:17.118363Z",
     "iopub.status.idle": "2026-08-17T14:45:19.502808Z",
     "shell.execute_reply": "2026-08-17T14:45:19.502258Z"
    }
   },
   "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": "92b0abf6",
   "metadata": {},
   "source": [
    "## Завершение (выполнить один раз, в самом конце)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "eae2a0a6",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:45:19.503800Z",
     "iopub.status.busy": "2026-08-17T14:45:19.503692Z",
     "iopub.status.idle": "2026-08-17T14:45:19.506607Z",
     "shell.execute_reply": "2026-08-17T14:45:19.506110Z"
    }
   },
   "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
}
