{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ae61632a-3702-4841-895f-ea899cfe4caa",
   "metadata": {},
   "source": [
    "# Python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "4407d8ee-320b-4cf1-8883-e807a6c1221e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'int'>\n"
     ]
    }
   ],
   "source": [
    "a=34\n",
    "print(type(a))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ee97deb6-be84-4a77-91f0-ccddb3a8a066",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "anhsirkiaJ\n"
     ]
    }
   ],
   "source": [
    "b=\"Jaikrishna\"\n",
    "print(b[::-1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "dd5f6530-36b5-4b51-980a-dd1cb73206df",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['This', 'is', 'a', 'string']\n"
     ]
    }
   ],
   "source": [
    "c= \"This is a string\"\n",
    "print(c.split())\n",
    "k = c.split()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "53a05f84-ea35-42a4-b101-e6a765bd62e0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "This-is-a-string\n"
     ]
    }
   ],
   "source": [
    "print(c.replace(\" \",\"-\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "3d38f128-0c9e-4f3f-a080-d12069b97316",
   "metadata": {},
   "outputs": [],
   "source": [
    "s=\"-\".join(k)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "dda2f290-543a-463f-be40-cb0c3e128639",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "This-is-a-string\n"
     ]
    }
   ],
   "source": [
    "print(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "2b52a9c8-2ab7-4f4a-bbc7-dbb29ee23e98",
   "metadata": {},
   "outputs": [],
   "source": [
    "a=[5,3,6,6,7,8]\n",
    "a.sort()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "dddbabe2-ce6a-4cb9-95cb-6b21cba15aeb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[3, 5, 6, 6, 7, 8]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "dd200973-f12f-469e-b908-97a569171b1a",
   "metadata": {},
   "outputs": [],
   "source": [
    "k = list(set(a))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "fbacfb7b-009d-46a4-8209-035574566296",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[3, 5, 6, 7, 8]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "k"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "5e969c8a-293e-4e78-9aea-6f65704d7ec8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "7\n"
     ]
    }
   ],
   "source": [
    "print(k[-2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "e49b5562-ebac-4854-905e-684d73d69539",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      " 5 3 7 2 1\n"
     ]
    }
   ],
   "source": [
    "arr = map(int, input().split())\n",
    "s = list(arr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "e7e53d52-5759-409c-b3dd-921800785705",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 5, 7]"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "0a14c9d7-eee5-4cf3-a75d-a82cb1a8581d",
   "metadata": {},
   "outputs": [],
   "source": [
    "s.sort()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "dfe478bc-dd7e-43fe-bfce-a3a83603364e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 5, 7]"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "005a5b31-3ee7-4721-9a90-08c9ae27b00b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s[-2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7727b7d7-9a5e-4852-9473-f81eefc1808b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "30\n"
     ]
    }
   ],
   "source": [
    "l=[10,20]\n",
    "print(sum(l))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "785663c6-8204-48fa-967a-61991e650f6b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      " 3\n",
      " Krishna 67 38 29\n",
      " ankit 23 45 67\n",
      " nitmi 45 23 34\n",
      " ankit\n"
     ]
    }
   ],
   "source": [
    "if __name__ == '__main__':\n",
    "    n = int(input())\n",
    "    student_marks = {}\n",
    "    \n",
    "    for _ in range(n):\n",
    "        name, *line = input().split()\n",
    "        scores = list(map(float, line))\n",
    "        student_marks[name] = scores\n",
    "    query_name = input()\n",
    "    for key in student_marks.items():\n",
    "        if key == query_name:\n",
    "            print(sum(value)/len(value))\n",
    "            "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "2e91e96d-dd78-45ca-80f1-2dc144d146a6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'Krishna': [67.0, 38.0, 29.0], 'ankit': [23.0, 45.0, 67.0], 'nitmi': [45.0, 23.0, 34.0]}\n"
     ]
    }
   ],
   "source": [
    "print(student_marks)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "62319c55-d44c-45b5-b63b-f58306cb5238",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "45.0\n"
     ]
    }
   ],
   "source": [
    "for key,value in student_marks.items():\n",
    "    if key == query_name:\n",
    "        print(sum(value)/len(value))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "62d44616-0d73-4aca-a049-d157fe77bf33",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      " 2\n",
      "Enter your command: insert 5 13\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "insert 5 13\n"
     ]
    },
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "Enter your command: remove\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "remove\n"
     ]
    }
   ],
   "source": [
    "if __name__ == '__main__':\n",
    "    N = int(input())\n",
    "    for i in range(N):\n",
    "        cmd = input(\"Enter your command:\")\n",
    "        print(cmd,sep=\" \")        \n",
    "    "
   ]
  },
  {
   "cell_type": "raw",
   "id": "b025b17a-2660-42d0-812f-57d4b44daedf",
   "metadata": {},
   "source": [
    "if __name__ == '__main__':\n",
    "    N = int(input())\n",
    "    for i in range(N):\n",
    "        cmd,*l = input(\"Enter your command:\").split()\n",
    "        print(list(map(int,l)))       \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c8a3c211-35f0-4794-b97d-efc0f3ac90ce",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      " 2\n",
      "Enter your command: insert 2 3\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['insert', '2', '3']\n"
     ]
    }
   ],
   "source": [
    "if __name__ == '__main__':\n",
    "    N = int(input())\n",
    "    for i in range(N):\n",
    "        cmd = input(\"Enter your command:\").split()\n",
    "        print(cmd)       \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "68a85617-8cf1-4863-af89-54a6823a61d0",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
