{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "16f957b0",
   "metadata": {},
   "source": [
    "# 08-09 · Krzyk i odwrócenie nazwy\n",
    "\n",
    "Praktyka do sekcji [„Mini-Projekty: Krzyczenie i przewracanie nazwy”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c45fe09c",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Zastosuj upper() i wycinek [::-1] w dwóch krótkich mini-projektach."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fb0455e6",
   "metadata": {},
   "source": [
    "## Pro input() w tym laptopie\n",
    "\n",
    "W normalnym życiu `.py`-plik `input()` czeka, aż wpiszesz i nacisniesz Enter. Ten laptop działa automatycznie, bez żywej osoby za klawiaturą – dlatego tu jest `input()` tymczasowo zastąpione gotowymi odpowiedziami. Sam kod `input()` poniżej wygląda i działa dokładnie jak zwykły plik, który sam uruchamiasz."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "83c921bd",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-02T06:07:46.513966Z",
     "iopub.status.busy": "2026-09-02T06:07:46.513856Z",
     "iopub.status.idle": "2026-09-02T06:07:46.530307Z",
     "shell.execute_reply": "2026-09-02T06:07:46.529812Z"
    }
   },
   "outputs": [],
   "source": [
    "_answers = iter(['python это круто', 'Cartesian', 'довод', 'Python'])\n",
    "\n",
    "def input(prompt=\"\"):\n",
    "    answer = next(_answers)\n",
    "    print(prompt + answer)\n",
    "    return answer"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "95b9036a",
   "metadata": {},
   "source": [
    "## Przykład roboczy – krzyczenie do ekranu"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "b468b3d2",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-02T06:07:46.531353Z",
     "iopub.status.busy": "2026-09-02T06:07:46.531236Z",
     "iopub.status.idle": "2026-09-02T06:07:46.533480Z",
     "shell.execute_reply": "2026-09-02T06:07:46.533066Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Что вы хотите прокричать? python это круто\n",
      "PYTHON ЭТО КРУТО!!!\n"
     ]
    }
   ],
   "source": [
    "phrase = input(\"Что вы хотите прокричать? \")\n",
    "krik = phrase.upper() + \"!!!\"\n",
    "print(krik)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c6161929",
   "metadata": {},
   "source": [
    "## Przykład roboczy – Zamiana nazwy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "b4067a39",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-02T06:07:46.534410Z",
     "iopub.status.busy": "2026-09-02T06:07:46.534308Z",
     "iopub.status.idle": "2026-09-02T06:07:46.536558Z",
     "shell.execute_reply": "2026-09-02T06:07:46.536131Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Как вас зовут? Cartesian\n",
      "Ваше имя задом наперёд: naisetraC\n"
     ]
    }
   ],
   "source": [
    "name = input(\"Как вас зовут? \")\n",
    "perevernutoe = name[::-1]\n",
    "print(f\"Ваше имя задом наперёд: {perevernutoe}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cb83c410",
   "metadata": {},
   "source": [
    "## Zadanie ★★ Zadanie samodzielne — palindrom?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "ad9ae818",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-02T06:07:46.537488Z",
     "iopub.status.busy": "2026-09-02T06:07:46.537385Z",
     "iopub.status.idle": "2026-09-02T06:07:46.539535Z",
     "shell.execute_reply": "2026-09-02T06:07:46.539195Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Введите слово: довод\n",
      "«довод» — палиндром: True\n"
     ]
    }
   ],
   "source": [
    "word = input(\"Введите слово: \")\n",
    "is_palindrome = word.lower() == word.lower()[::-1]\n",
    "print(f\"«{word}» — палиндром: {is_palindrome}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1fb0f396",
   "metadata": {},
   "source": [
    "## Sprawdzenie wyniku"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a824784d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-02T06:07:46.540631Z",
     "iopub.status.busy": "2026-09-02T06:07:46.540527Z",
     "iopub.status.idle": "2026-09-02T06:07:46.542573Z",
     "shell.execute_reply": "2026-09-02T06:07:46.542215Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Введите слово: Python\n",
      "False\n"
     ]
    }
   ],
   "source": [
    "word = input(\"Введите слово: \")\n",
    "print(word.lower() == word.lower()[::-1])"
   ]
  }
 ],
 "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
}
