{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "25d742d6",
   "metadata": {},
   "source": [
    "# 08-22 · Weryfikacja hasła i e-mail\n",
    "\n",
    "Praktyka do sekcji [„Mini-projekt: hasło i e-mail”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b51a3c28",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Zbieraj metody walidacji łańcuch znaków (isdigit, isalpha in) w prostej walidacji danych wejściowych."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "65e746ed",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "61686cf5",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T16:19:00.076632Z",
     "iopub.status.busy": "2026-08-16T16:19:00.076254Z",
     "iopub.status.idle": "2026-08-16T16:19:00.093446Z",
     "shell.execute_reply": "2026-08-16T16:19:00.092980Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n",
      "True\n"
     ]
    }
   ],
   "source": [
    "password = \"abc12345\"\n",
    "print(len(password) >= 8)\n",
    "print(any(ch.isdigit() for ch in password))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5805aa63",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Sprawdź `password = \"abc12345\"` według trzech zasad (długość od 8, jest liczba, jest litera) – wynik jest w `nadyozhnyj`. Sprawdzone `email = \"ada@cartesianschool.org\"` — jest dokładnie jedno „@” `pohozhe_na_email`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5bf6d9a7",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T16:19:00.094472Z",
     "iopub.status.busy": "2026-08-16T16:19:00.094358Z",
     "iopub.status.idle": "2026-08-16T16:19:00.097288Z",
     "shell.execute_reply": "2026-08-16T16:19:00.096885Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True True\n"
     ]
    }
   ],
   "source": [
    "password = \"abc12345\"\n",
    "dostatochno_dlinnyj = len(password) >= 8\n",
    "est_cifra = any(ch.isdigit() for ch in password)\n",
    "est_bukva = any(ch.isalpha() for ch in password)\n",
    "nadyozhnyj = dostatochno_dlinnyj and est_cifra and est_bukva\n",
    "\n",
    "email = \"ada@cartesianschool.org\"\n",
    "est_sobachka = \"@\" in email\n",
    "odna_sobachka = email.count(\"@\") == 1\n",
    "pohozhe_na_email = est_sobachka and odna_sobachka\n",
    "\n",
    "print(nadyozhnyj, pohozhe_na_email)"
   ]
  }
 ],
 "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
}
