Skip to content

Commit 7b0217e

Browse files
committed
Map Function
1 parent 56835b2 commit 7b0217e

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Input.ipynb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,39 @@
123123
"print(lst) "
124124
]
125125
},
126+
{
127+
"cell_type": "code",
128+
"execution_count": 6,
129+
"metadata": {},
130+
"outputs": [
131+
{
132+
"name": "stdin",
133+
"output_type": "stream",
134+
"text": [
135+
"Enter number of elements : 5\n",
136+
"\n",
137+
"Enter the numbers : 1 2 3 4 5\n"
138+
]
139+
},
140+
{
141+
"name": "stdout",
142+
"output_type": "stream",
143+
"text": [
144+
"\n",
145+
"List is - [1, 2, 3, 4, 5]\n"
146+
]
147+
}
148+
],
149+
"source": [
150+
"# number of elements \n",
151+
"n = int(input(\"Enter number of elements : \")) \n",
152+
"\n",
153+
"# Below line read inputs from user using map() function \n",
154+
"a = list(map(int,input(\"\\nEnter the numbers : \").strip().split()))[:n] \n",
155+
"\n",
156+
"print(\"\\nList is - \", a) \n"
157+
]
158+
},
126159
{
127160
"cell_type": "code",
128161
"execution_count": null,

0 commit comments

Comments
 (0)