{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e9c0199c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d471766f",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "7ed298fb",
   "metadata": {},
   "outputs": [],
   "source": [
    "# نمونه فانگشن\n",
    "def name():\n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "9a8714ae",
   "metadata": {},
   "outputs": [],
   "source": [
    "def hi():\n",
    "    print('سلام به شما')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "146ff8a6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "سلام به شما\n"
     ]
    }
   ],
   "source": [
    "hi()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f5c8dc50",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "سلام به شما\n"
     ]
    }
   ],
   "source": [
    "hi()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "c8bd9a42",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "سلام به شما\n"
     ]
    }
   ],
   "source": [
    "a = hi()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "95603171",
   "metadata": {},
   "outputs": [],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "0c53062e",
   "metadata": {},
   "outputs": [],
   "source": [
    "def hi():\n",
    "    return 'سلام به شما'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "8a0e09e0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'سلام به شما'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hi()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "c6e1d2d1",
   "metadata": {},
   "outputs": [],
   "source": [
    "a = hi()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "f514c689",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'سلام به شما'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7514222d",
   "metadata": {},
   "outputs": [],
   "source": [
    "def hi():\n",
    "    return f'سلام به '"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a4e73cf9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "skgmeg\n"
     ]
    }
   ],
   "source": [
    "print('skgmeg')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "79072a1a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "54"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "int('54')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8a97af4e",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "c6ea2b7f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "int()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "089d0f5c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'d'"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "input('hi')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "31cd027a",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "type() takes 1 or 3 arguments",
     "output_type": "error",
     "traceback": [
      "\u001b[31m---------------------------------------------------------------------------\u001b[39m",
      "\u001b[31mTypeError\u001b[39m                                 Traceback (most recent call last)",
      "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[17]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m type()\n",
      "\u001b[31mTypeError\u001b[39m: type() takes 1 or 3 arguments"
     ]
    }
   ],
   "source": [
    "type()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "b9aaf308",
   "metadata": {},
   "outputs": [],
   "source": [
    "def hi(name):\n",
    "    return f'سلام به '"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "0aef11a2",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "hi() missing 1 required positional argument: 'name'",
     "output_type": "error",
     "traceback": [
      "\u001b[31m---------------------------------------------------------------------------\u001b[39m",
      "\u001b[31mTypeError\u001b[39m                                 Traceback (most recent call last)",
      "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[20]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m hi()\n",
      "\u001b[31mTypeError\u001b[39m: hi() missing 1 required positional argument: 'name'"
     ]
    }
   ],
   "source": [
    "hi()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "a2d5eadc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'سلام به '"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hi('Hamed')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "f7a04118",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'سلام به '"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hi('حامد')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "ef3bc0b4",
   "metadata": {},
   "outputs": [],
   "source": [
    "def hi(name):\n",
    "    return f'سلام به {name}'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "32c9c54e",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "hi() missing 1 required positional argument: 'name'",
     "output_type": "error",
     "traceback": [
      "\u001b[31m---------------------------------------------------------------------------\u001b[39m",
      "\u001b[31mTypeError\u001b[39m                                 Traceback (most recent call last)",
      "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[24]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m hi()\n",
      "\u001b[31mTypeError\u001b[39m: hi() missing 1 required positional argument: 'name'"
     ]
    }
   ],
   "source": [
    "hi()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "1973c75f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'سلام به حامد'"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hi('حامد')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "23f0b54a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'سلام به ایلیا'"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hi('ایلیا')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "2c2a997a",
   "metadata": {},
   "outputs": [],
   "source": [
    "def masahat(add1, add2):\n",
    "    return add1*add2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "28902000",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "60"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "masahat(12,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "a346b481",
   "metadata": {},
   "outputs": [],
   "source": [
    "def hi(name='شما'):\n",
    "    return f'سلام به {name}'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "4030a796",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'سلام به شما'"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hi()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "632937ec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'سلام به حامد'"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hi('حامد')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "f21fad80",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "None\n"
     ]
    }
   ],
   "source": [
    "a = None\n",
    "print(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "e39c9a53",
   "metadata": {},
   "outputs": [],
   "source": [
    "x = None\n",
    "\n",
    "if x:\n",
    "    print('hi')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "7c23a174",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hi\n"
     ]
    }
   ],
   "source": [
    "x = 'test'\n",
    "\n",
    "if x:\n",
    "    print('hi')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "56f60ef9",
   "metadata": {},
   "outputs": [],
   "source": [
    "def hi(name=None):\n",
    "    if name:\n",
    "        return f'سلام به {name}'\n",
    "    else:\n",
    "        return 'سلام به شما'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "cbaa13c7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'سلام به شما'"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hi()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "3d7cf74c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'سلام به حامد'"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hi('حامد')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "ed234aa8",
   "metadata": {},
   "outputs": [],
   "source": [
    "def test(name, lname, city):\n",
    "    return f'سلام به {name} {lname} از شهر {city}'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "bf25b5ea",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'سلام به حامد خلیلاوی از شهر تهران'"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test('حامد','خلیلاوی','تهران')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "a9acc384",
   "metadata": {},
   "outputs": [],
   "source": [
    "def masahat(add1:int , add2:int):\n",
    "    return add1 * add2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "5a19c5ce",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "masahat(3,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "99292002",
   "metadata": {},
   "outputs": [],
   "source": [
    "def list_printer(task_list):\n",
    "    for i in task_list:\n",
    "        print(f\"✔️ {i} ✔️\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "443cd77e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "✔️ hamed ✔️\n",
      "✔️ ali ✔️\n",
      "✔️ hasan ✔️\n"
     ]
    }
   ],
   "source": [
    "a = ['hamed' , 'ali', 'hasan']\n",
    "list_printer(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "1b016634",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.0\n"
     ]
    }
   ],
   "source": [
    "def cal(add1, alamat, add2):\n",
    "    add1 = int(add1)\n",
    "    add2 = int(add2)\n",
    "    if alamat == '+':\n",
    "        return add1 + add2\n",
    "    elif alamat == '-':\n",
    "        return add1 - add2\n",
    "    elif alamat == '*':\n",
    "        return add1 * add2\n",
    "    elif alamat == '/':\n",
    "        return add1 / add2\n",
    "    \n",
    "\n",
    "\n",
    "add1 = input('عدد اول را وارد کنید')\n",
    "alamat = input('نوع محاسبه را وارد کنید')\n",
    "add2 = input('عدد دوم را وارد کنید')\n",
    "a = cal(add1,  alamat, add2)\n",
    "print(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "7aaaec52",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hamed\n",
      "HAMED\n"
     ]
    }
   ],
   "source": [
    "name = 'Hamed'\n",
    "print(name.lower())\n",
    "print(name.upper())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "d410ae7d",
   "metadata": {},
   "outputs": [],
   "source": [
    "kewords = {'فنی':['خطا', 'ارور', 'پنل', 'دسترسی', 'تنظیمات', 'اتصال'],\n",
    "               'مالی':['قیمت', 'خرید', 'اشتراک', 'درگاه', 'پرداخت', 'تخفیف'],\n",
    "               'پشتیبانی':['کمک', 'سلام', 'راهنمایی', 'سوال']\n",
    "               }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0e966ec4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_items([('فنی', ['خطا', 'ارور', 'پنل', 'دسترسی', 'تنظیمات', 'اتصال']), ('مالی', ['قیمت', 'خرید', 'اشتراک', 'درگاه', 'پرداخت', 'تخفیف']), ('پشتیبانی', ['کمک', 'سلام', 'راهنمایی', 'سوال'])])"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kewords.items()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "8cb0d002",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "فنی\n",
      "پشتیبانی\n"
     ]
    }
   ],
   "source": [
    "text = 'سلام من خطا گرفتم'\n",
    "for category, tags in kewords.items():\n",
    "    for tag in tags:\n",
    "        if tag in text:\n",
    "            print(category)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "3ae07271",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'فنی'"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def categorize_message(text:str):\n",
    "\n",
    "    kewords = {'فنی':['خطا', 'ارور', 'پنل', 'دسترسی', 'تنظیمات', 'اتصال'],\n",
    "               'مالی':['قیمت', 'خرید', 'اشتراک', 'درگاه', 'پرداخت', 'تخفیف'],\n",
    "               'پشتیبانی':['کمک', 'سلام', 'راهنمایی', 'سوال']\n",
    "               }\n",
    "    \n",
    "    for category, tags in kewords.items():\n",
    "        for tag in tags:\n",
    "            if tag in text:\n",
    "                return category\n",
    "            \n",
    "    return 'دسته مورد نظری یافت نشد'\n",
    "\n",
    "\n",
    "text = 'من دارم روس سایت خودم کار میکنم و به خطا خوردم کمک'\n",
    "categorize_message(text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2333d6a3",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "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.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
