Skip to content

Commit 120eee3

Browse files
Add files via upload
1 parent acb7dc1 commit 120eee3

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

Assignment-18.ipynb

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 2,
6+
"id": "283418d7",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"def filter_list(lst):\n",
11+
" int_lst=[]\n",
12+
" for i in lst:\n",
13+
" if type(i) == int:\n",
14+
" int_lst.append(i)\n",
15+
" return int_lst"
16+
]
17+
},
18+
{
19+
"cell_type": "code",
20+
"execution_count": 7,
21+
"id": "89458259",
22+
"metadata": {},
23+
"outputs": [
24+
{
25+
"name": "stdout",
26+
"output_type": "stream",
27+
"text": [
28+
"[1, 2]\n",
29+
"[1, 0, 15]\n",
30+
"[1, 2, 123]\n"
31+
]
32+
}
33+
],
34+
"source": [
35+
"print(filter_list([1, 2, \"a\", \"b\"]))\n",
36+
"print(filter_list([1, \"a\", \"b\", 0, 15]) )\n",
37+
"print(filter_list([1, 2, \"aasf\", \"1\", \"123\", 123]) )"
38+
]
39+
},
40+
{
41+
"cell_type": "code",
42+
"execution_count": 12,
43+
"id": "b068b840",
44+
"metadata": {},
45+
"outputs": [],
46+
"source": [
47+
"def reverse(s):\n",
48+
" rev= s[::-1]\n",
49+
" swpcse= rev.swapcase()\n",
50+
" return swpcse"
51+
]
52+
},
53+
{
54+
"cell_type": "code",
55+
"execution_count": 14,
56+
"id": "e0e08358",
57+
"metadata": {},
58+
"outputs": [
59+
{
60+
"name": "stdout",
61+
"output_type": "stream",
62+
"text": [
63+
"DLROw OLLEh\n",
64+
"eSrEvEr\n",
65+
"RADAr\n"
66+
]
67+
}
68+
],
69+
"source": [
70+
"print(reverse(\"Hello World\"))\n",
71+
"print(reverse(\"ReVeRsE\"))\n",
72+
"print(reverse(\"Radar\"))"
73+
]
74+
},
75+
{
76+
"cell_type": "code",
77+
"execution_count": 20,
78+
"id": "6bb76d12",
79+
"metadata": {},
80+
"outputs": [
81+
{
82+
"name": "stdout",
83+
"output_type": "stream",
84+
"text": [
85+
"1\n",
86+
"[2, 3, 4, 5]\n",
87+
"6\n"
88+
]
89+
}
90+
],
91+
"source": [
92+
"lst = [1, 2, 3, 4, 5, 6]\n",
93+
"first = lst[0]\n",
94+
"middle = lst[1:-1]\n",
95+
"last = lst[-1]\n",
96+
"print(first)\n",
97+
"print(middle)\n",
98+
"print(last)"
99+
]
100+
}
101+
],
102+
"metadata": {
103+
"kernelspec": {
104+
"display_name": "Python 3",
105+
"language": "python",
106+
"name": "python3"
107+
},
108+
"language_info": {
109+
"codemirror_mode": {
110+
"name": "ipython",
111+
"version": 3
112+
},
113+
"file_extension": ".py",
114+
"mimetype": "text/x-python",
115+
"name": "python",
116+
"nbconvert_exporter": "python",
117+
"pygments_lexer": "ipython3",
118+
"version": "3.6.9"
119+
}
120+
},
121+
"nbformat": 4,
122+
"nbformat_minor": 5
123+
}

0 commit comments

Comments
 (0)