Search is not available for this dataset
text
stringlengths 1.97k
97.3M
| id
stringlengths 21
24
| file_path
stringclasses 53
values |
---|---|---|
{
"cells": [
{
"cell_type": "markdown",
"id": "e62f7c7f",
"metadata": {
"papermill": {
"duration": 0.013468,
"end_time": "2022-10-13T10:35:21.147440",
"exception": false,
"start_time": "2022-10-13T10:35:21.133972",
"status": "completed"
},
"tags": []
},
"source": [
"**String basis**"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "3d193c86",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.175777Z",
"iopub.status.busy": "2022-10-13T10:35:21.174757Z",
"iopub.status.idle": "2022-10-13T10:35:21.189739Z",
"shell.execute_reply": "2022-10-13T10:35:21.187156Z"
},
"papermill": {
"duration": 0.031644,
"end_time": "2022-10-13T10:35:21.193582",
"exception": false,
"start_time": "2022-10-13T10:35:21.161938",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Data analytics\n"
]
}
],
"source": [
"a= \"Data analytics\"\n",
"print(a)"
]
},
{
"cell_type": "markdown",
"id": "14ef0937",
"metadata": {
"papermill": {
"duration": 0.011585,
"end_time": "2022-10-13T10:35:21.216489",
"exception": false,
"start_time": "2022-10-13T10:35:21.204904",
"status": "completed"
},
"tags": []
},
"source": [
"**String Indexing**"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "e5735a24",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.238462Z",
"iopub.status.busy": "2022-10-13T10:35:21.238063Z",
"iopub.status.idle": "2022-10-13T10:35:21.248394Z",
"shell.execute_reply": "2022-10-13T10:35:21.247178Z"
},
"papermill": {
"duration": 0.024634,
"end_time": "2022-10-13T10:35:21.251173",
"exception": false,
"start_time": "2022-10-13T10:35:21.226539",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'D'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a[0]"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "475ab960",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.276889Z",
"iopub.status.busy": "2022-10-13T10:35:21.276024Z",
"iopub.status.idle": "2022-10-13T10:35:21.282920Z",
"shell.execute_reply": "2022-10-13T10:35:21.281994Z"
},
"papermill": {
"duration": 0.022387,
"end_time": "2022-10-13T10:35:21.285141",
"exception": false,
"start_time": "2022-10-13T10:35:21.262754",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"14"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(a)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "4a49cd0a",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.309520Z",
"iopub.status.busy": "2022-10-13T10:35:21.309043Z",
"iopub.status.idle": "2022-10-13T10:35:21.316001Z",
"shell.execute_reply": "2022-10-13T10:35:21.314868Z"
},
"papermill": {
"duration": 0.021196,
"end_time": "2022-10-13T10:35:21.318216",
"exception": false,
"start_time": "2022-10-13T10:35:21.297020",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'c'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a[-2]"
]
},
{
"cell_type": "markdown",
"id": "62765fbe",
"metadata": {
"papermill": {
"duration": 0.010597,
"end_time": "2022-10-13T10:35:21.339574",
"exception": false,
"start_time": "2022-10-13T10:35:21.328977",
"status": "completed"
},
"tags": []
},
"source": [
"**String slicing**"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "0511c8af",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.364380Z",
"iopub.status.busy": "2022-10-13T10:35:21.363888Z",
"iopub.status.idle": "2022-10-13T10:35:21.370275Z",
"shell.execute_reply": "2022-10-13T10:35:21.369212Z"
},
"papermill": {
"duration": 0.022306,
"end_time": "2022-10-13T10:35:21.372677",
"exception": false,
"start_time": "2022-10-13T10:35:21.350371",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'y'"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a=\"Python\"\n",
"a[1]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "860b3b11",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.395586Z",
"iopub.status.busy": "2022-10-13T10:35:21.395239Z",
"iopub.status.idle": "2022-10-13T10:35:21.401264Z",
"shell.execute_reply": "2022-10-13T10:35:21.400231Z"
},
"papermill": {
"duration": 0.020174,
"end_time": "2022-10-13T10:35:21.403461",
"exception": false,
"start_time": "2022-10-13T10:35:21.383287",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'Pyth'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a[0:4]"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "2b4648b2",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.431943Z",
"iopub.status.busy": "2022-10-13T10:35:21.431485Z",
"iopub.status.idle": "2022-10-13T10:35:21.438558Z",
"shell.execute_reply": "2022-10-13T10:35:21.437555Z"
},
"papermill": {
"duration": 0.028199,
"end_time": "2022-10-13T10:35:21.442499",
"exception": false,
"start_time": "2022-10-13T10:35:21.414300",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'on'"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a[4:7]"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "95bb71c9",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.470559Z",
"iopub.status.busy": "2022-10-13T10:35:21.469644Z",
"iopub.status.idle": "2022-10-13T10:35:21.476742Z",
"shell.execute_reply": "2022-10-13T10:35:21.475841Z"
},
"papermill": {
"duration": 0.02416,
"end_time": "2022-10-13T10:35:21.478800",
"exception": false,
"start_time": "2022-10-13T10:35:21.454640",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'Pto'"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a[0:7:2]"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "ceac2e9f",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.504349Z",
"iopub.status.busy": "2022-10-13T10:35:21.503584Z",
"iopub.status.idle": "2022-10-13T10:35:21.509690Z",
"shell.execute_reply": "2022-10-13T10:35:21.508997Z"
},
"papermill": {
"duration": 0.022003,
"end_time": "2022-10-13T10:35:21.511886",
"exception": false,
"start_time": "2022-10-13T10:35:21.489883",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'Ph'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a[0:7:3]"
]
},
{
"cell_type": "markdown",
"id": "5b101d6e",
"metadata": {
"papermill": {
"duration": 0.010852,
"end_time": "2022-10-13T10:35:21.533877",
"exception": false,
"start_time": "2022-10-13T10:35:21.523025",
"status": "completed"
},
"tags": []
},
"source": [
"**Splitting**"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "f39f3945",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.558004Z",
"iopub.status.busy": "2022-10-13T10:35:21.556832Z",
"iopub.status.idle": "2022-10-13T10:35:21.563110Z",
"shell.execute_reply": "2022-10-13T10:35:21.562345Z"
},
"papermill": {
"duration": 0.020248,
"end_time": "2022-10-13T10:35:21.564965",
"exception": false,
"start_time": "2022-10-13T10:35:21.544717",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"-1"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"add=\"22 Anna nagar Chennai\"\n",
"add.find(\"chennai\")"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "a6aa55be",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.588945Z",
"iopub.status.busy": "2022-10-13T10:35:21.588263Z",
"iopub.status.idle": "2022-10-13T10:35:21.594965Z",
"shell.execute_reply": "2022-10-13T10:35:21.593884Z"
},
"papermill": {
"duration": 0.020927,
"end_time": "2022-10-13T10:35:21.597016",
"exception": false,
"start_time": "2022-10-13T10:35:21.576089",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"add.find(\"22\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "eab60a92",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.621747Z",
"iopub.status.busy": "2022-10-13T10:35:21.621114Z",
"iopub.status.idle": "2022-10-13T10:35:21.627078Z",
"shell.execute_reply": "2022-10-13T10:35:21.625864Z"
},
"papermill": {
"duration": 0.021376,
"end_time": "2022-10-13T10:35:21.629769",
"exception": false,
"start_time": "2022-10-13T10:35:21.608393",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['We', 'are', 'doing', 'a', 'good', 'progress']\n"
]
}
],
"source": [
"z=\"We are doing a good progress\"\n",
"s=z.split()\n",
"print(s)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "f0c42a0b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.654534Z",
"iopub.status.busy": "2022-10-13T10:35:21.654201Z",
"iopub.status.idle": "2022-10-13T10:35:21.660684Z",
"shell.execute_reply": "2022-10-13T10:35:21.659697Z"
},
"papermill": {
"duration": 0.021026,
"end_time": "2022-10-13T10:35:21.662773",
"exception": false,
"start_time": "2022-10-13T10:35:21.641747",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'We'"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s[0]"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "adc84720",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.687312Z",
"iopub.status.busy": "2022-10-13T10:35:21.686678Z",
"iopub.status.idle": "2022-10-13T10:35:21.693398Z",
"shell.execute_reply": "2022-10-13T10:35:21.692411Z"
},
"papermill": {
"duration": 0.02129,
"end_time": "2022-10-13T10:35:21.695447",
"exception": false,
"start_time": "2022-10-13T10:35:21.674157",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"['We', 'are', 'doing', 'a', 'good', 'progress']"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y=\"We-are-doing-a-good-progress\"\n",
"y.split(\"-\")"
]
},
{
"cell_type": "markdown",
"id": "4bd02ca8",
"metadata": {
"papermill": {
"duration": 0.011067,
"end_time": "2022-10-13T10:35:21.718127",
"exception": false,
"start_time": "2022-10-13T10:35:21.707060",
"status": "completed"
},
"tags": []
},
"source": [
"**Stripping**"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "32ac2bf5",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.742531Z",
"iopub.status.busy": "2022-10-13T10:35:21.742151Z",
"iopub.status.idle": "2022-10-13T10:35:21.748913Z",
"shell.execute_reply": "2022-10-13T10:35:21.747811Z"
},
"papermill": {
"duration": 0.021348,
"end_time": "2022-10-13T10:35:21.750867",
"exception": false,
"start_time": "2022-10-13T10:35:21.729519",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"7"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d=\"Finance\"\n",
"e=\" Finance\"\n",
"d==e\n",
"len(d)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "04210e4a",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.776460Z",
"iopub.status.busy": "2022-10-13T10:35:21.776071Z",
"iopub.status.idle": "2022-10-13T10:35:21.782349Z",
"shell.execute_reply": "2022-10-13T10:35:21.781378Z"
},
"papermill": {
"duration": 0.021924,
"end_time": "2022-10-13T10:35:21.784507",
"exception": false,
"start_time": "2022-10-13T10:35:21.762583",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"9"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(e)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "16878786",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.809827Z",
"iopub.status.busy": "2022-10-13T10:35:21.809199Z",
"iopub.status.idle": "2022-10-13T10:35:21.815720Z",
"shell.execute_reply": "2022-10-13T10:35:21.814640Z"
},
"papermill": {
"duration": 0.0216,
"end_time": "2022-10-13T10:35:21.817943",
"exception": false,
"start_time": "2022-10-13T10:35:21.796343",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'Finance'"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"e.strip()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "6b328467",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.843466Z",
"iopub.status.busy": "2022-10-13T10:35:21.843106Z",
"iopub.status.idle": "2022-10-13T10:35:21.849068Z",
"shell.execute_reply": "2022-10-13T10:35:21.848075Z"
},
"papermill": {
"duration": 0.020949,
"end_time": "2022-10-13T10:35:21.851298",
"exception": false,
"start_time": "2022-10-13T10:35:21.830349",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"' Finance'"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"e"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "3be2ee72",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.876632Z",
"iopub.status.busy": "2022-10-13T10:35:21.876248Z",
"iopub.status.idle": "2022-10-13T10:35:21.882946Z",
"shell.execute_reply": "2022-10-13T10:35:21.881853Z"
},
"papermill": {
"duration": 0.021877,
"end_time": "2022-10-13T10:35:21.884990",
"exception": false,
"start_time": "2022-10-13T10:35:21.863113",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'Finance'"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"e=e.strip()\n",
"e"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "74753028",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.910900Z",
"iopub.status.busy": "2022-10-13T10:35:21.910273Z",
"iopub.status.idle": "2022-10-13T10:35:21.915895Z",
"shell.execute_reply": "2022-10-13T10:35:21.914951Z"
},
"papermill": {
"duration": 0.021089,
"end_time": "2022-10-13T10:35:21.918117",
"exception": false,
"start_time": "2022-10-13T10:35:21.897028",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d==e"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "92e3a1e3",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.944011Z",
"iopub.status.busy": "2022-10-13T10:35:21.943576Z",
"iopub.status.idle": "2022-10-13T10:35:21.950343Z",
"shell.execute_reply": "2022-10-13T10:35:21.949302Z"
},
"papermill": {
"duration": 0.022194,
"end_time": "2022-10-13T10:35:21.952426",
"exception": false,
"start_time": "2022-10-13T10:35:21.930232",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'Anita '"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"name=\" Anita \"\n",
"name=name.lstrip()\n",
"name"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "c533aece",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:21.979199Z",
"iopub.status.busy": "2022-10-13T10:35:21.978775Z",
"iopub.status.idle": "2022-10-13T10:35:21.985377Z",
"shell.execute_reply": "2022-10-13T10:35:21.984399Z"
},
"papermill": {
"duration": 0.022024,
"end_time": "2022-10-13T10:35:21.987551",
"exception": false,
"start_time": "2022-10-13T10:35:21.965527",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"' Anita'"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"name=\" Anita \"\n",
"name=name.rstrip()\n",
"name"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "827affd4",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.014200Z",
"iopub.status.busy": "2022-10-13T10:35:22.013270Z",
"iopub.status.idle": "2022-10-13T10:35:22.020018Z",
"shell.execute_reply": "2022-10-13T10:35:22.019072Z"
},
"papermill": {
"duration": 0.0225,
"end_time": "2022-10-13T10:35:22.022233",
"exception": false,
"start_time": "2022-10-13T10:35:21.999733",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'I am learning Python'"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"w=\" I am learning Python \"\n",
"w=w.strip()\n",
"w"
]
},
{
"cell_type": "markdown",
"id": "1008ed86",
"metadata": {
"papermill": {
"duration": 0.0122,
"end_time": "2022-10-13T10:35:22.046793",
"exception": false,
"start_time": "2022-10-13T10:35:22.034593",
"status": "completed"
},
"tags": []
},
"source": [
"**In-build method**"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "ca753bd2",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.073110Z",
"iopub.status.busy": "2022-10-13T10:35:22.072474Z",
"iopub.status.idle": "2022-10-13T10:35:22.078192Z",
"shell.execute_reply": "2022-10-13T10:35:22.077481Z"
},
"papermill": {
"duration": 0.020961,
"end_time": "2022-10-13T10:35:22.080097",
"exception": false,
"start_time": "2022-10-13T10:35:22.059136",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"password=\"xyz123\"\n",
"password.isalnum()"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "e52fb020",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.106502Z",
"iopub.status.busy": "2022-10-13T10:35:22.106131Z",
"iopub.status.idle": "2022-10-13T10:35:22.112435Z",
"shell.execute_reply": "2022-10-13T10:35:22.111389Z"
},
"papermill": {
"duration": 0.021986,
"end_time": "2022-10-13T10:35:22.114513",
"exception": false,
"start_time": "2022-10-13T10:35:22.092527",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s=\"Hello\"\n",
"s.isalpha()"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "32918ab3",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.141757Z",
"iopub.status.busy": "2022-10-13T10:35:22.141370Z",
"iopub.status.idle": "2022-10-13T10:35:22.148056Z",
"shell.execute_reply": "2022-10-13T10:35:22.147069Z"
},
"papermill": {
"duration": 0.022376,
"end_time": "2022-10-13T10:35:22.150061",
"exception": false,
"start_time": "2022-10-13T10:35:22.127685",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"name=\"Anita\"\n",
"name.isupper()"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "b749bae0",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.176866Z",
"iopub.status.busy": "2022-10-13T10:35:22.176463Z",
"iopub.status.idle": "2022-10-13T10:35:22.183115Z",
"shell.execute_reply": "2022-10-13T10:35:22.182083Z"
},
"papermill": {
"duration": 0.022502,
"end_time": "2022-10-13T10:35:22.185251",
"exception": false,
"start_time": "2022-10-13T10:35:22.162749",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"name=\"anita\"\n",
"name.islower()"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "17a30111",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.213366Z",
"iopub.status.busy": "2022-10-13T10:35:22.212973Z",
"iopub.status.idle": "2022-10-13T10:35:22.219769Z",
"shell.execute_reply": "2022-10-13T10:35:22.218555Z"
},
"papermill": {
"duration": 0.02274,
"end_time": "2022-10-13T10:35:22.221938",
"exception": false,
"start_time": "2022-10-13T10:35:22.199198",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'DELHI'"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"city=\"Delhi\"\n",
"city=city.upper()\n",
"city"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "33a2a4e7",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.249565Z",
"iopub.status.busy": "2022-10-13T10:35:22.249188Z",
"iopub.status.idle": "2022-10-13T10:35:22.255382Z",
"shell.execute_reply": "2022-10-13T10:35:22.254413Z"
},
"papermill": {
"duration": 0.022885,
"end_time": "2022-10-13T10:35:22.257670",
"exception": false,
"start_time": "2022-10-13T10:35:22.234785",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'delhi'"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"city=city.lower()\n",
"city"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "03868999",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.286150Z",
"iopub.status.busy": "2022-10-13T10:35:22.285757Z",
"iopub.status.idle": "2022-10-13T10:35:22.297941Z",
"shell.execute_reply": "2022-10-13T10:35:22.296841Z"
},
"papermill": {
"duration": 0.02875,
"end_time": "2022-10-13T10:35:22.299973",
"exception": false,
"start_time": "2022-10-13T10:35:22.271223",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'India'"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"country=\"india\"\n",
"country.capitalize()"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "a4fae3b6",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.328235Z",
"iopub.status.busy": "2022-10-13T10:35:22.327824Z",
"iopub.status.idle": "2022-10-13T10:35:22.334153Z",
"shell.execute_reply": "2022-10-13T10:35:22.333136Z"
},
"papermill": {
"duration": 0.023439,
"end_time": "2022-10-13T10:35:22.336423",
"exception": false,
"start_time": "2022-10-13T10:35:22.312984",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'Anita Balan'"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"name=\"aNITA bALAN\"\n",
"name.swapcase()"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "e6162958",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.365187Z",
"iopub.status.busy": "2022-10-13T10:35:22.364771Z",
"iopub.status.idle": "2022-10-13T10:35:22.371005Z",
"shell.execute_reply": "2022-10-13T10:35:22.369924Z"
},
"papermill": {
"duration": 0.023552,
"end_time": "2022-10-13T10:35:22.373250",
"exception": false,
"start_time": "2022-10-13T10:35:22.349698",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'Anita Balan'"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"name=\"anita balan\"\n",
"name.title()"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "40d7dd60",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.401644Z",
"iopub.status.busy": "2022-10-13T10:35:22.401295Z",
"iopub.status.idle": "2022-10-13T10:35:22.407374Z",
"shell.execute_reply": "2022-10-13T10:35:22.406283Z"
},
"papermill": {
"duration": 0.023024,
"end_time": "2022-10-13T10:35:22.409599",
"exception": false,
"start_time": "2022-10-13T10:35:22.386575",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"name.endswith(\"balan\")"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "a5bea756",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.437930Z",
"iopub.status.busy": "2022-10-13T10:35:22.437526Z",
"iopub.status.idle": "2022-10-13T10:35:22.443805Z",
"shell.execute_reply": "2022-10-13T10:35:22.442731Z"
},
"papermill": {
"duration": 0.023215,
"end_time": "2022-10-13T10:35:22.446131",
"exception": false,
"start_time": "2022-10-13T10:35:22.422916",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"name.endswith(\"n\")"
]
},
{
"cell_type": "markdown",
"id": "b2f48fc2",
"metadata": {
"papermill": {
"duration": 0.013707,
"end_time": "2022-10-13T10:35:22.473333",
"exception": false,
"start_time": "2022-10-13T10:35:22.459626",
"status": "completed"
},
"tags": []
},
"source": [
"**Looping in string**"
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "ef744a1f",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.502783Z",
"iopub.status.busy": "2022-10-13T10:35:22.501606Z",
"iopub.status.idle": "2022-10-13T10:35:22.508765Z",
"shell.execute_reply": "2022-10-13T10:35:22.506953Z"
},
"papermill": {
"duration": 0.024403,
"end_time": "2022-10-13T10:35:22.511460",
"exception": false,
"start_time": "2022-10-13T10:35:22.487057",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"I\n",
" \n",
"a\n",
"m\n",
" \n",
"l\n",
"e\n",
"a\n",
"r\n",
"n\n",
"i\n",
"n\n",
"g\n",
" \n",
"p\n",
"y\n",
"t\n",
"h\n",
"o\n",
"n\n"
]
}
],
"source": [
"a=\"I am learning python\"\n",
"for i in a:\n",
" print(i)"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "e2577b72",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.540405Z",
"iopub.status.busy": "2022-10-13T10:35:22.540025Z",
"iopub.status.idle": "2022-10-13T10:35:22.545802Z",
"shell.execute_reply": "2022-10-13T10:35:22.544706Z"
},
"papermill": {
"duration": 0.022968,
"end_time": "2022-10-13T10:35:22.548218",
"exception": false,
"start_time": "2022-10-13T10:35:22.525250",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"I\n",
"am\n",
"learning\n",
"Python\n"
]
}
],
"source": [
"a=\"I am learning Python\"\n",
"b=a.split()\n",
"for i in b:\n",
" print(i)"
]
},
{
"cell_type": "markdown",
"id": "1b16db3a",
"metadata": {
"papermill": {
"duration": 0.014066,
"end_time": "2022-10-13T10:35:22.576092",
"exception": false,
"start_time": "2022-10-13T10:35:22.562026",
"status": "completed"
},
"tags": []
},
"source": [
"**Reserve a string**"
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "ec6216a2",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.605180Z",
"iopub.status.busy": "2022-10-13T10:35:22.604789Z",
"iopub.status.idle": "2022-10-13T10:35:22.610554Z",
"shell.execute_reply": "2022-10-13T10:35:22.609798Z"
},
"papermill": {
"duration": 0.022542,
"end_time": "2022-10-13T10:35:22.612532",
"exception": false,
"start_time": "2022-10-13T10:35:22.589990",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"20"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(a)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "fc278e05",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.642686Z",
"iopub.status.busy": "2022-10-13T10:35:22.642252Z",
"iopub.status.idle": "2022-10-13T10:35:22.648576Z",
"shell.execute_reply": "2022-10-13T10:35:22.647539Z"
},
"papermill": {
"duration": 0.024566,
"end_time": "2022-10-13T10:35:22.650921",
"exception": false,
"start_time": "2022-10-13T10:35:22.626355",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'AnitaBalan'"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"Anita\"+\"Balan\""
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "42ae5f1d",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:35:22.680049Z",
"iopub.status.busy": "2022-10-13T10:35:22.679634Z",
"iopub.status.idle": "2022-10-13T10:35:22.686376Z",
"shell.execute_reply": "2022-10-13T10:35:22.684989Z"
},
"papermill": {
"duration": 0.023865,
"end_time": "2022-10-13T10:35:22.688655",
"exception": false,
"start_time": "2022-10-13T10:35:22.664790",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"n\n",
"no\n",
"noh\n",
"noht\n",
"nohty\n",
"nohtyP\n",
"nohtyP \n",
"nohtyP g\n",
"nohtyP gn\n",
"nohtyP gni\n",
"nohtyP gnin\n",
"nohtyP gninr\n",
"nohtyP gninra\n",
"nohtyP gninrae\n",
"nohtyP gninrael\n",
"nohtyP gninrael \n",
"nohtyP gninrael m\n",
"nohtyP gninrael ma\n",
"nohtyP gninrael ma \n",
"nohtyP gninrael ma I\n",
"nohtyP gninrael ma I\n"
]
}
],
"source": [
"l=len(a)\n",
"r=\"\"\n",
"while l>0:\n",
" r=r+a[l-1]\n",
" print(r)\n",
" l=l-1\n",
"print(r)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a9a24bf8",
"metadata": {
"papermill": {
"duration": 0.013528,
"end_time": "2022-10-13T10:35:22.716310",
"exception": false,
"start_time": "2022-10-13T10:35:22.702782",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "77b82095",
"metadata": {
"papermill": {
"duration": 0.013395,
"end_time": "2022-10-13T10:35:22.743421",
"exception": false,
"start_time": "2022-10-13T10:35:22.730026",
"status": "completed"
},
"tags": []
},
"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.7.12"
},
"papermill": {
"default_parameters": {},
"duration": 10.815935,
"end_time": "2022-10-13T10:35:23.377722",
"environment_variables": {},
"exception": null,
"input_path": "__notebook__.ipynb",
"output_path": "__notebook__.ipynb",
"parameters": {},
"start_time": "2022-10-13T10:35:12.561787",
"version": "2.3.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
| 0107/959/107959359.ipynb | s3://data-agents/kaggle-outputs/sharded/028_00107.jsonl.gz |
{
"cells": [
{
"cell_type": "markdown",
"id": "064b0504",
"metadata": {
"papermill": {
"duration": 0.015103,
"end_time": "2022-10-13T10:37:43.074835",
"exception": false,
"start_time": "2022-10-13T10:37:43.059732",
"status": "completed"
},
"tags": []
},
"source": [
"**LIST**"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "f41e4edd",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.103371Z",
"iopub.status.busy": "2022-10-13T10:37:43.102889Z",
"iopub.status.idle": "2022-10-13T10:37:43.118018Z",
"shell.execute_reply": "2022-10-13T10:37:43.116783Z"
},
"papermill": {
"duration": 0.032323,
"end_time": "2022-10-13T10:37:43.120672",
"exception": false,
"start_time": "2022-10-13T10:37:43.088349",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"list"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"l1=[]\n",
"type(l1)"
]
},
{
"cell_type": "markdown",
"id": "39df9f1a",
"metadata": {
"papermill": {
"duration": 0.012209,
"end_time": "2022-10-13T10:37:43.147443",
"exception": false,
"start_time": "2022-10-13T10:37:43.135234",
"status": "completed"
},
"tags": []
},
"source": [
"**String list**"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "e36ba915",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.174266Z",
"iopub.status.busy": "2022-10-13T10:37:43.173808Z",
"iopub.status.idle": "2022-10-13T10:37:43.180493Z",
"shell.execute_reply": "2022-10-13T10:37:43.179652Z"
},
"papermill": {
"duration": 0.02264,
"end_time": "2022-10-13T10:37:43.182594",
"exception": false,
"start_time": "2022-10-13T10:37:43.159954",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"list"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"l2=[\"Anita\",\"Balansundari\",\"Subin\"]\n",
"type(l2)"
]
},
{
"cell_type": "markdown",
"id": "efb6ac65",
"metadata": {
"papermill": {
"duration": 0.012968,
"end_time": "2022-10-13T10:37:43.208204",
"exception": false,
"start_time": "2022-10-13T10:37:43.195236",
"status": "completed"
},
"tags": []
},
"source": [
"**Integer list**"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "7cf5e430",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.236318Z",
"iopub.status.busy": "2022-10-13T10:37:43.235883Z",
"iopub.status.idle": "2022-10-13T10:37:43.243262Z",
"shell.execute_reply": "2022-10-13T10:37:43.241917Z"
},
"papermill": {
"duration": 0.024138,
"end_time": "2022-10-13T10:37:43.245746",
"exception": false,
"start_time": "2022-10-13T10:37:43.221608",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"list"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"l3=[34,43,45]\n",
"type(l3)"
]
},
{
"cell_type": "markdown",
"id": "2e503602",
"metadata": {
"papermill": {
"duration": 0.012962,
"end_time": "2022-10-13T10:37:43.272093",
"exception": false,
"start_time": "2022-10-13T10:37:43.259131",
"status": "completed"
},
"tags": []
},
"source": [
"**Floating list point**"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "805293e2",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.300666Z",
"iopub.status.busy": "2022-10-13T10:37:43.300217Z",
"iopub.status.idle": "2022-10-13T10:37:43.308028Z",
"shell.execute_reply": "2022-10-13T10:37:43.306903Z"
},
"papermill": {
"duration": 0.024949,
"end_time": "2022-10-13T10:37:43.310421",
"exception": false,
"start_time": "2022-10-13T10:37:43.285472",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"list"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"l4=[34.5,65.3,98.7]\n",
"type(l4)"
]
},
{
"cell_type": "markdown",
"id": "172656e0",
"metadata": {
"papermill": {
"duration": 0.013151,
"end_time": "2022-10-13T10:37:43.336815",
"exception": false,
"start_time": "2022-10-13T10:37:43.323664",
"status": "completed"
},
"tags": []
},
"source": [
"**Indexing list**"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "b5f8c092",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.364960Z",
"iopub.status.busy": "2022-10-13T10:37:43.364602Z",
"iopub.status.idle": "2022-10-13T10:37:43.371210Z",
"shell.execute_reply": "2022-10-13T10:37:43.370131Z"
},
"papermill": {
"duration": 0.023389,
"end_time": "2022-10-13T10:37:43.373661",
"exception": false,
"start_time": "2022-10-13T10:37:43.350272",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"'AB'"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a=[\"AB\",80.5,180]\n",
"a[0]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "8096cac4",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.402088Z",
"iopub.status.busy": "2022-10-13T10:37:43.401709Z",
"iopub.status.idle": "2022-10-13T10:37:43.408742Z",
"shell.execute_reply": "2022-10-13T10:37:43.407654Z"
},
"papermill": {
"duration": 0.023624,
"end_time": "2022-10-13T10:37:43.410887",
"exception": false,
"start_time": "2022-10-13T10:37:43.387263",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"180"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a[-1]"
]
},
{
"cell_type": "markdown",
"id": "7b23ecec",
"metadata": {
"papermill": {
"duration": 0.013395,
"end_time": "2022-10-13T10:37:43.438103",
"exception": false,
"start_time": "2022-10-13T10:37:43.424708",
"status": "completed"
},
"tags": []
},
"source": [
"*Iteration*"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "ca44669d",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.466952Z",
"iopub.status.busy": "2022-10-13T10:37:43.466266Z",
"iopub.status.idle": "2022-10-13T10:37:43.471628Z",
"shell.execute_reply": "2022-10-13T10:37:43.470835Z"
},
"papermill": {
"duration": 0.022434,
"end_time": "2022-10-13T10:37:43.474206",
"exception": false,
"start_time": "2022-10-13T10:37:43.451772",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"AB\n",
"80.5\n",
"180\n"
]
}
],
"source": [
"for i in a:\n",
" print(i)"
]
},
{
"cell_type": "markdown",
"id": "918cd704",
"metadata": {
"papermill": {
"duration": 0.014014,
"end_time": "2022-10-13T10:37:43.503066",
"exception": false,
"start_time": "2022-10-13T10:37:43.489052",
"status": "completed"
},
"tags": []
},
"source": [
"**List function**"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "26fbbcf8",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.531302Z",
"iopub.status.busy": "2022-10-13T10:37:43.530846Z",
"iopub.status.idle": "2022-10-13T10:37:43.538502Z",
"shell.execute_reply": "2022-10-13T10:37:43.537135Z"
},
"papermill": {
"duration": 0.024334,
"end_time": "2022-10-13T10:37:43.540675",
"exception": false,
"start_time": "2022-10-13T10:37:43.516341",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"['I', 'am', 'learning', 'list']"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"S=\"I am learning list\"\n",
"d=S.split()\n",
"d"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "88989e68",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.568865Z",
"iopub.status.busy": "2022-10-13T10:37:43.568489Z",
"iopub.status.idle": "2022-10-13T10:37:43.574614Z",
"shell.execute_reply": "2022-10-13T10:37:43.573636Z"
},
"papermill": {
"duration": 0.022774,
"end_time": "2022-10-13T10:37:43.576614",
"exception": false,
"start_time": "2022-10-13T10:37:43.553840",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"list"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"type(d)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "043f1957",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.605182Z",
"iopub.status.busy": "2022-10-13T10:37:43.604639Z",
"iopub.status.idle": "2022-10-13T10:37:43.612822Z",
"shell.execute_reply": "2022-10-13T10:37:43.611528Z"
},
"papermill": {
"duration": 0.024946,
"end_time": "2022-10-13T10:37:43.615184",
"exception": false,
"start_time": "2022-10-13T10:37:43.590238",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"['I',\n",
" ' ',\n",
" 'a',\n",
" 'm',\n",
" ' ',\n",
" 'l',\n",
" 'e',\n",
" 'a',\n",
" 'r',\n",
" 'n',\n",
" 'i',\n",
" 'n',\n",
" 'g',\n",
" ' ',\n",
" 'l',\n",
" 'i',\n",
" 's',\n",
" 't']"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"p=list(S) #break down individual character of string into list\n",
"p"
]
},
{
"cell_type": "markdown",
"id": "0a17fd24",
"metadata": {
"papermill": {
"duration": 0.015056,
"end_time": "2022-10-13T10:37:43.645609",
"exception": false,
"start_time": "2022-10-13T10:37:43.630553",
"status": "completed"
},
"tags": []
},
"source": [
"**Method on list-1**"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "b28431af",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.675665Z",
"iopub.status.busy": "2022-10-13T10:37:43.675259Z",
"iopub.status.idle": "2022-10-13T10:37:43.682982Z",
"shell.execute_reply": "2022-10-13T10:37:43.681841Z"
},
"papermill": {
"duration": 0.024798,
"end_time": "2022-10-13T10:37:43.685076",
"exception": false,
"start_time": "2022-10-13T10:37:43.660278",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[23, 32, 43, 45, 65, 78, 12]"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks=[23,32,43,45,65,78]\n",
"marks.append(12) #it will add the data at the end by default\n",
"marks"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "8e933b95",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.714372Z",
"iopub.status.busy": "2022-10-13T10:37:43.713920Z",
"iopub.status.idle": "2022-10-13T10:37:43.721108Z",
"shell.execute_reply": "2022-10-13T10:37:43.720020Z"
},
"papermill": {
"duration": 0.024314,
"end_time": "2022-10-13T10:37:43.723274",
"exception": false,
"start_time": "2022-10-13T10:37:43.698960",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[23, 30, 32, 43, 45, 65, 78, 12]"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks.insert(1,30) #1 is the index & 30 is the data\n",
"marks"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "156da188",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.753209Z",
"iopub.status.busy": "2022-10-13T10:37:43.752808Z",
"iopub.status.idle": "2022-10-13T10:37:43.759866Z",
"shell.execute_reply": "2022-10-13T10:37:43.758787Z"
},
"papermill": {
"duration": 0.025594,
"end_time": "2022-10-13T10:37:43.762866",
"exception": false,
"start_time": "2022-10-13T10:37:43.737272",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[22, 30, 32, 43, 45, 65, 78, 12]"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks[0]=22\n",
"marks"
]
},
{
"cell_type": "markdown",
"id": "acca7de2",
"metadata": {
"papermill": {
"duration": 0.016804,
"end_time": "2022-10-13T10:37:43.797781",
"exception": false,
"start_time": "2022-10-13T10:37:43.780977",
"status": "completed"
},
"tags": []
},
"source": [
"*How do we merge 2 list*"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "fc2aa01f",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.836268Z",
"iopub.status.busy": "2022-10-13T10:37:43.835873Z",
"iopub.status.idle": "2022-10-13T10:37:43.843414Z",
"shell.execute_reply": "2022-10-13T10:37:43.842171Z"
},
"papermill": {
"duration": 0.02943,
"end_time": "2022-10-13T10:37:43.845714",
"exception": false,
"start_time": "2022-10-13T10:37:43.816284",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[22, 30, 32, 43, 45, 65, 78, 12, 10, 29, 34, 49]"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks2=[10,29,34,49]\n",
"marks.extend(marks2)\n",
"marks"
]
},
{
"cell_type": "markdown",
"id": "013018d7",
"metadata": {
"papermill": {
"duration": 0.013813,
"end_time": "2022-10-13T10:37:43.873731",
"exception": false,
"start_time": "2022-10-13T10:37:43.859918",
"status": "completed"
},
"tags": []
},
"source": [
"**Methods 2**"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "638c3dda",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.904535Z",
"iopub.status.busy": "2022-10-13T10:37:43.904136Z",
"iopub.status.idle": "2022-10-13T10:37:43.911188Z",
"shell.execute_reply": "2022-10-13T10:37:43.909941Z"
},
"papermill": {
"duration": 0.025715,
"end_time": "2022-10-13T10:37:43.913679",
"exception": false,
"start_time": "2022-10-13T10:37:43.887964",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[22, 30, 32, 43, 45, 65, 78, 12, 10, 29, 34]"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks.pop() #by default it will pop the last element\n",
"marks"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "00a513aa",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.946354Z",
"iopub.status.busy": "2022-10-13T10:37:43.945886Z",
"iopub.status.idle": "2022-10-13T10:37:43.953861Z",
"shell.execute_reply": "2022-10-13T10:37:43.952614Z"
},
"papermill": {
"duration": 0.027006,
"end_time": "2022-10-13T10:37:43.956369",
"exception": false,
"start_time": "2022-10-13T10:37:43.929363",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[22, 30, 32, 43, 45, 78, 12, 10, 29, 34]"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks.pop(5) #the argument takes the value of index\n",
"marks"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "5d097985",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:43.987216Z",
"iopub.status.busy": "2022-10-13T10:37:43.986789Z",
"iopub.status.idle": "2022-10-13T10:37:43.994174Z",
"shell.execute_reply": "2022-10-13T10:37:43.993030Z"
},
"papermill": {
"duration": 0.0256,
"end_time": "2022-10-13T10:37:43.996518",
"exception": false,
"start_time": "2022-10-13T10:37:43.970918",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[22, 30, 32, 45, 78, 12, 10, 29, 34]"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks.remove(43)\n",
"marks"
]
},
{
"cell_type": "markdown",
"id": "4d5fff89",
"metadata": {
"papermill": {
"duration": 0.014935,
"end_time": "2022-10-13T10:37:44.026038",
"exception": false,
"start_time": "2022-10-13T10:37:44.011103",
"status": "completed"
},
"tags": []
},
"source": [
"*Delete operators*"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "cd861e0b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.057283Z",
"iopub.status.busy": "2022-10-13T10:37:44.056864Z",
"iopub.status.idle": "2022-10-13T10:37:44.063656Z",
"shell.execute_reply": "2022-10-13T10:37:44.062756Z"
},
"papermill": {
"duration": 0.025313,
"end_time": "2022-10-13T10:37:44.066080",
"exception": false,
"start_time": "2022-10-13T10:37:44.040767",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[22, 30, 32, 78, 12, 10, 29, 34]"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"del marks[3]\n",
"marks"
]
},
{
"cell_type": "markdown",
"id": "6ada62a6",
"metadata": {
"papermill": {
"duration": 0.017769,
"end_time": "2022-10-13T10:37:44.098690",
"exception": false,
"start_time": "2022-10-13T10:37:44.080921",
"status": "completed"
},
"tags": []
},
"source": [
"**Some more functions on lists**"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "bf6950e3",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.142044Z",
"iopub.status.busy": "2022-10-13T10:37:44.141665Z",
"iopub.status.idle": "2022-10-13T10:37:44.149553Z",
"shell.execute_reply": "2022-10-13T10:37:44.148289Z"
},
"papermill": {
"duration": 0.032272,
"end_time": "2022-10-13T10:37:44.151943",
"exception": false,
"start_time": "2022-10-13T10:37:44.119671",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"247"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sum(marks)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "53d498e4",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.186872Z",
"iopub.status.busy": "2022-10-13T10:37:44.186484Z",
"iopub.status.idle": "2022-10-13T10:37:44.194040Z",
"shell.execute_reply": "2022-10-13T10:37:44.192957Z"
},
"papermill": {
"duration": 0.027621,
"end_time": "2022-10-13T10:37:44.196181",
"exception": false,
"start_time": "2022-10-13T10:37:44.168560",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks.count(30)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "79856176",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.232236Z",
"iopub.status.busy": "2022-10-13T10:37:44.231787Z",
"iopub.status.idle": "2022-10-13T10:37:44.238498Z",
"shell.execute_reply": "2022-10-13T10:37:44.237411Z"
},
"papermill": {
"duration": 0.025059,
"end_time": "2022-10-13T10:37:44.240640",
"exception": false,
"start_time": "2022-10-13T10:37:44.215581",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(marks)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "c15e2a12",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.275070Z",
"iopub.status.busy": "2022-10-13T10:37:44.273955Z",
"iopub.status.idle": "2022-10-13T10:37:44.281605Z",
"shell.execute_reply": "2022-10-13T10:37:44.280373Z"
},
"papermill": {
"duration": 0.027278,
"end_time": "2022-10-13T10:37:44.283952",
"exception": false,
"start_time": "2022-10-13T10:37:44.256674",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"30.875"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"avg=sum(marks)/len(marks)\n",
"avg"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "0c8283ca",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.316579Z",
"iopub.status.busy": "2022-10-13T10:37:44.315515Z",
"iopub.status.idle": "2022-10-13T10:37:44.323401Z",
"shell.execute_reply": "2022-10-13T10:37:44.322189Z"
},
"papermill": {
"duration": 0.026923,
"end_time": "2022-10-13T10:37:44.325740",
"exception": false,
"start_time": "2022-10-13T10:37:44.298817",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"10"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"min(marks)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "a8dce62b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.358782Z",
"iopub.status.busy": "2022-10-13T10:37:44.357591Z",
"iopub.status.idle": "2022-10-13T10:37:44.365089Z",
"shell.execute_reply": "2022-10-13T10:37:44.363971Z"
},
"papermill": {
"duration": 0.026817,
"end_time": "2022-10-13T10:37:44.367570",
"exception": false,
"start_time": "2022-10-13T10:37:44.340753",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"78"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"max(marks)"
]
},
{
"cell_type": "markdown",
"id": "ce3c4a54",
"metadata": {
"papermill": {
"duration": 0.016523,
"end_time": "2022-10-13T10:37:44.400364",
"exception": false,
"start_time": "2022-10-13T10:37:44.383841",
"status": "completed"
},
"tags": []
},
"source": [
"**Sorting of list**"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "073b96bf",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.433806Z",
"iopub.status.busy": "2022-10-13T10:37:44.433427Z",
"iopub.status.idle": "2022-10-13T10:37:44.439606Z",
"shell.execute_reply": "2022-10-13T10:37:44.438767Z"
},
"papermill": {
"duration": 0.025609,
"end_time": "2022-10-13T10:37:44.441939",
"exception": false,
"start_time": "2022-10-13T10:37:44.416330",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[22, 30, 32, 78, 12, 10, 29, 34]"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "86aec6bb",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.478745Z",
"iopub.status.busy": "2022-10-13T10:37:44.478295Z",
"iopub.status.idle": "2022-10-13T10:37:44.485991Z",
"shell.execute_reply": "2022-10-13T10:37:44.483853Z"
},
"papermill": {
"duration": 0.031583,
"end_time": "2022-10-13T10:37:44.488782",
"exception": false,
"start_time": "2022-10-13T10:37:44.457199",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[10, 12, 22, 29, 30, 32, 34, 78]"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks.sort() #by default it is ascending\n",
"marks"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "04444e7b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.537743Z",
"iopub.status.busy": "2022-10-13T10:37:44.537003Z",
"iopub.status.idle": "2022-10-13T10:37:44.543260Z",
"shell.execute_reply": "2022-10-13T10:37:44.542434Z"
},
"papermill": {
"duration": 0.033571,
"end_time": "2022-10-13T10:37:44.545772",
"exception": false,
"start_time": "2022-10-13T10:37:44.512201",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[78, 34, 32, 30, 29, 22, 12, 10]"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks.sort(reverse=True)\n",
"marks"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "526ddf9a",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.583097Z",
"iopub.status.busy": "2022-10-13T10:37:44.582394Z",
"iopub.status.idle": "2022-10-13T10:37:44.589023Z",
"shell.execute_reply": "2022-10-13T10:37:44.588176Z"
},
"papermill": {
"duration": 0.026216,
"end_time": "2022-10-13T10:37:44.591128",
"exception": false,
"start_time": "2022-10-13T10:37:44.564912",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[10, 12, 22, 29, 30, 32, 34, 78]"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks.reverse()\n",
"marks"
]
},
{
"cell_type": "markdown",
"id": "71a95385",
"metadata": {
"papermill": {
"duration": 0.015628,
"end_time": "2022-10-13T10:37:44.622786",
"exception": false,
"start_time": "2022-10-13T10:37:44.607158",
"status": "completed"
},
"tags": []
},
"source": [
"**Slicing in the list**"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "6407ce44",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.655337Z",
"iopub.status.busy": "2022-10-13T10:37:44.654887Z",
"iopub.status.idle": "2022-10-13T10:37:44.661880Z",
"shell.execute_reply": "2022-10-13T10:37:44.661010Z"
},
"papermill": {
"duration": 0.025991,
"end_time": "2022-10-13T10:37:44.664087",
"exception": false,
"start_time": "2022-10-13T10:37:44.638096",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[10, 12, 22, 29, 30, 32, 34, 78]"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "3c4e373c",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.697889Z",
"iopub.status.busy": "2022-10-13T10:37:44.697365Z",
"iopub.status.idle": "2022-10-13T10:37:44.704167Z",
"shell.execute_reply": "2022-10-13T10:37:44.703348Z"
},
"papermill": {
"duration": 0.026175,
"end_time": "2022-10-13T10:37:44.706233",
"exception": false,
"start_time": "2022-10-13T10:37:44.680058",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[10, 12, 22, 29]"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks[0:4]"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "3527dcab",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.740403Z",
"iopub.status.busy": "2022-10-13T10:37:44.739726Z",
"iopub.status.idle": "2022-10-13T10:37:44.746883Z",
"shell.execute_reply": "2022-10-13T10:37:44.745831Z"
},
"papermill": {
"duration": 0.026588,
"end_time": "2022-10-13T10:37:44.749139",
"exception": false,
"start_time": "2022-10-13T10:37:44.722551",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[10, 12, 22, 29]"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks[:4] #by default the first index is 0"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "736b548f",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.782956Z",
"iopub.status.busy": "2022-10-13T10:37:44.782224Z",
"iopub.status.idle": "2022-10-13T10:37:44.789028Z",
"shell.execute_reply": "2022-10-13T10:37:44.787993Z"
},
"papermill": {
"duration": 0.025956,
"end_time": "2022-10-13T10:37:44.791205",
"exception": false,
"start_time": "2022-10-13T10:37:44.765249",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[22, 29, 30, 32, 34, 78]"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks[2:10]"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "c3789acb",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.824853Z",
"iopub.status.busy": "2022-10-13T10:37:44.823702Z",
"iopub.status.idle": "2022-10-13T10:37:44.831008Z",
"shell.execute_reply": "2022-10-13T10:37:44.829899Z"
},
"papermill": {
"duration": 0.026462,
"end_time": "2022-10-13T10:37:44.833358",
"exception": false,
"start_time": "2022-10-13T10:37:44.806896",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[22, 29, 30, 32, 34, 78]"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks[2:] #by default the last index is the last element"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "c405f747",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.867976Z",
"iopub.status.busy": "2022-10-13T10:37:44.867553Z",
"iopub.status.idle": "2022-10-13T10:37:44.874906Z",
"shell.execute_reply": "2022-10-13T10:37:44.873733Z"
},
"papermill": {
"duration": 0.027273,
"end_time": "2022-10-13T10:37:44.877002",
"exception": false,
"start_time": "2022-10-13T10:37:44.849729",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[12, 22, 29]"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks[1:4]"
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "fb5b7278",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.910845Z",
"iopub.status.busy": "2022-10-13T10:37:44.910105Z",
"iopub.status.idle": "2022-10-13T10:37:44.916632Z",
"shell.execute_reply": "2022-10-13T10:37:44.915434Z"
},
"papermill": {
"duration": 0.026093,
"end_time": "2022-10-13T10:37:44.918965",
"exception": false,
"start_time": "2022-10-13T10:37:44.892872",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[10, 22, 30, 34]"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks[0:10:2]"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "3c275050",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:44.953696Z",
"iopub.status.busy": "2022-10-13T10:37:44.953314Z",
"iopub.status.idle": "2022-10-13T10:37:44.959624Z",
"shell.execute_reply": "2022-10-13T10:37:44.958778Z"
},
"papermill": {
"duration": 0.026101,
"end_time": "2022-10-13T10:37:44.961630",
"exception": false,
"start_time": "2022-10-13T10:37:44.935529",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"[10, 30]"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"marks[::4]"
]
},
{
"cell_type": "markdown",
"id": "30a5c950",
"metadata": {
"papermill": {
"duration": 0.01651,
"end_time": "2022-10-13T10:37:44.994824",
"exception": false,
"start_time": "2022-10-13T10:37:44.978314",
"status": "completed"
},
"tags": []
},
"source": [
"**Assignment-1**----------\n",
"*Concatenate 2 strings index wise*"
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "458e8de6",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:45.029806Z",
"iopub.status.busy": "2022-10-13T10:37:45.029080Z",
"iopub.status.idle": "2022-10-13T10:37:45.036024Z",
"shell.execute_reply": "2022-10-13T10:37:45.034933Z"
},
"papermill": {
"duration": 0.026917,
"end_time": "2022-10-13T10:37:45.038256",
"exception": false,
"start_time": "2022-10-13T10:37:45.011339",
"status": "completed"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Anita B', 'Charles J', 'Subin B']\n"
]
}
],
"source": [
"first_name=[\"Anita\",\"Charles\",\"Subin\"]\n",
"Last_name=[\"B\",\"J\",\"B\"]\n",
"l=len(first_name)\n",
"name=[]\n",
"for i in range(l):\n",
" x=first_name[i]+\" \"+Last_name[i]\n",
" name.append(x)\n",
"print(name)"
]
},
{
"cell_type": "markdown",
"id": "dd1cbe9b",
"metadata": {
"papermill": {
"duration": 0.015793,
"end_time": "2022-10-13T10:37:45.070575",
"exception": false,
"start_time": "2022-10-13T10:37:45.054782",
"status": "completed"
},
"tags": []
},
"source": [
"**2.How many times a particular item is there in a list**"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "49dbc7ac",
"metadata": {
"execution": {
"iopub.execute_input": "2022-10-13T10:37:45.104823Z",
"iopub.status.busy": "2022-10-13T10:37:45.104142Z",
"iopub.status.idle": "2022-10-13T10:37:45.175682Z",
"shell.execute_reply": "2022-10-13T10:37:45.174031Z"
},
"papermill": {
"duration": 0.091226,
"end_time": "2022-10-13T10:37:45.177885",
"exception": true,
"start_time": "2022-10-13T10:37:45.086659",
"status": "failed"
},
"tags": []
},
"outputs": [
{
"ename": "StdinNotImplementedError",
"evalue": "raw_input was called, but this frontend does not support input requests.",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mStdinNotImplementedError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/tmp/ipykernel_19/1906999639.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0ml\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m7\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m9\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mnum\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Enter the number\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mcount\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0ml\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mnum\u001b[0m\u001b[0;34m==\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/opt/conda/lib/python3.7/site-packages/ipykernel/kernelbase.py\u001b[0m in \u001b[0;36mraw_input\u001b[0;34m(self, prompt)\u001b[0m\n\u001b[1;32m 1173\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_allow_stdin\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1174\u001b[0m raise StdinNotImplementedError(\n\u001b[0;32m-> 1175\u001b[0;31m \u001b[0;34m\"raw_input was called, but this frontend does not support input requests.\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1176\u001b[0m )\n\u001b[1;32m 1177\u001b[0m return self._input_request(\n",
"\u001b[0;31mStdinNotImplementedError\u001b[0m: raw_input was called, but this frontend does not support input requests."
]
}
],
"source": [
"l=[2,3,1,2,7,9,2]\n",
"num=int(input(\"Enter the number\"))\n",
"count=0\n",
"for i in l:\n",
" if num==i:\n",
" count=count+1\n",
"print(num,\"is occuring\",count,\"times\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3346c843",
"metadata": {
"execution": {
"iopub.execute_input": "2022-09-24T05:38:04.942314Z",
"iopub.status.busy": "2022-09-24T05:38:04.941494Z",
"iopub.status.idle": "2022-09-24T05:38:13.245301Z",
"shell.execute_reply": "2022-09-24T05:38:13.244394Z",
"shell.execute_reply.started": "2022-09-24T05:38:04.942275Z"
},
"papermill": {
"duration": null,
"end_time": null,
"exception": null,
"start_time": null,
"status": "pending"
},
"tags": []
},
"outputs": [],
"source": [
"l=[2,3,1,2,7,9,2,3]\n",
"num= int(input(\"Enter the number\"))\n",
"print(l.count(num))"
]
},
{
"cell_type": "markdown",
"id": "f70f842c",
"metadata": {
"papermill": {
"duration": null,
"end_time": null,
"exception": null,
"start_time": null,
"status": "pending"
},
"tags": []
},
"source": [
"**Remove occurance of a particular item form a list**"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "32d9db94",
"metadata": {
"execution": {
"iopub.execute_input": "2022-09-24T05:43:01.918646Z",
"iopub.status.busy": "2022-09-24T05:43:01.918215Z",
"iopub.status.idle": "2022-09-24T05:43:05.951229Z",
"shell.execute_reply": "2022-09-24T05:43:05.950271Z",
"shell.execute_reply.started": "2022-09-24T05:43:01.918609Z"
},
"papermill": {
"duration": null,
"end_time": null,
"exception": null,
"start_time": null,
"status": "pending"
},
"tags": []
},
"outputs": [],
"source": [
"b=[23,22,56,36,96,2,2,23]\n",
"num1=int(input(\"Enter the number that you start to remove\"))\n",
"for i in b:\n",
" if i==num1:\n",
" b.remove(i)\n",
"print(b)"
]
},
{
"cell_type": "markdown",
"id": "e38ce6d9",
"metadata": {
"papermill": {
"duration": null,
"end_time": null,
"exception": null,
"start_time": null,
"status": "pending"
},
"tags": []
},
"source": [
"**Check if we have a common element in two list**"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4b34444a",
"metadata": {
"execution": {
"iopub.execute_input": "2022-09-24T06:14:59.158251Z",
"iopub.status.busy": "2022-09-24T06:14:59.157852Z",
"iopub.status.idle": "2022-09-24T06:14:59.165128Z",
"shell.execute_reply": "2022-09-24T06:14:59.163642Z",
"shell.execute_reply.started": "2022-09-24T06:14:59.158220Z"
},
"papermill": {
"duration": null,
"end_time": null,
"exception": null,
"start_time": null,
"status": "pending"
},
"tags": []
},
"outputs": [],
"source": [
"l1=[1,2,3]\n",
"l2=[3,4,5]\n",
"for i in l1:\n",
" for j in l2:\n",
" if i==j:\n",
" print(i)\n",
" break"
]
},
{
"cell_type": "markdown",
"id": "ea27cfb9",
"metadata": {
"papermill": {
"duration": null,
"end_time": null,
"exception": null,
"start_time": null,
"status": "pending"
},
"tags": []
},
"source": [
"**Remove duplicate value from the list**"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ce18ca94",
"metadata": {
"execution": {
"iopub.execute_input": "2022-09-24T06:19:14.972816Z",
"iopub.status.busy": "2022-09-24T06:19:14.972385Z",
"iopub.status.idle": "2022-09-24T06:19:14.980373Z",
"shell.execute_reply": "2022-09-24T06:19:14.978933Z",
"shell.execute_reply.started": "2022-09-24T06:19:14.972779Z"
},
"papermill": {
"duration": null,
"end_time": null,
"exception": null,
"start_time": null,
"status": "pending"
},
"tags": []
},
"outputs": [],
"source": [
"l2=[1,2,3,1,4,5,2]\n",
"for i in l2:\n",
" count=0\n",
" for j in l2:\n",
" if i==j:\n",
" count=count+1\n",
" if count>1:\n",
" l2.remove(i)\n",
"print(l2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5aa308b9",
"metadata": {
"execution": {
"iopub.execute_input": "2022-09-24T06:18:24.417927Z",
"iopub.status.busy": "2022-09-24T06:18:24.417458Z",
"iopub.status.idle": "2022-09-24T06:18:24.428206Z",
"shell.execute_reply": "2022-09-24T06:18:24.427029Z",
"shell.execute_reply.started": "2022-09-24T06:18:24.417883Z"
},
"papermill": {
"duration": null,
"end_time": null,
"exception": null,
"start_time": null,
"status": "pending"
},
"tags": []
},
"outputs": [],
"source": [
"l2"
]
}
],
"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.7.12"
},
"papermill": {
"default_parameters": {},
"duration": 11.767902,
"end_time": "2022-10-13T10:37:45.816933",
"environment_variables": {},
"exception": true,
"input_path": "__notebook__.ipynb",
"output_path": "__notebook__.ipynb",
"parameters": {},
"start_time": "2022-10-13T10:37:34.049031",
"version": "2.3.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
| 0107/959/107959579.ipynb | s3://data-agents/kaggle-outputs/sharded/028_00107.jsonl.gz |
"{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"ecbfbd(...TRUNCATED) | 0107/960/107960113.ipynb | s3://data-agents/kaggle-outputs/sharded/028_00107.jsonl.gz |
"{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"91e87440\",\n \"metadata\": (...TRUNCATED) | 0107/960/107960513.ipynb | s3://data-agents/kaggle-outputs/sharded/028_00107.jsonl.gz |
"{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"a0b541(...TRUNCATED) | 0107/961/107961433.ipynb | s3://data-agents/kaggle-outputs/sharded/028_00107.jsonl.gz |
"{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"a11a7e(...TRUNCATED) | 0107/961/107961506.ipynb | s3://data-agents/kaggle-outputs/sharded/028_00107.jsonl.gz |
"{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"3f3270(...TRUNCATED) | 0107/961/107961600.ipynb | s3://data-agents/kaggle-outputs/sharded/028_00107.jsonl.gz |
"{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"59c425(...TRUNCATED) | 0107/963/107963476.ipynb | s3://data-agents/kaggle-outputs/sharded/028_00107.jsonl.gz |
"{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"684f7585\",\n \"metadata\": (...TRUNCATED) | 0107/963/107963501.ipynb | s3://data-agents/kaggle-outputs/sharded/028_00107.jsonl.gz |
"{\n \"cells\": [\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"a9eb26(...TRUNCATED) | 0107/963/107963615.ipynb | s3://data-agents/kaggle-outputs/sharded/028_00107.jsonl.gz |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
- Downloads last month
- 8