Skip to content

Commit e444756

Browse files
committed
update Ch02-1
1 parent 3eec34b commit e444756

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

notebooks/Ch02-1-Data-Variables-StdIO.ipynb

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,12 +1152,12 @@
11521152
]
11531153
},
11541154
{
1155-
"cell_type": "code",
1156-
"execution_count": 1,
1155+
"cell_type": "markdown",
11571156
"metadata": {},
1158-
"outputs": [],
11591157
"source": [
1160-
"gene1 = 10*\"AGT\""
1158+
"### How to read multiple values in a single line\n",
1159+
"\n",
1160+
"- use split() method of string class to split the input string into multiple values"
11611161
]
11621162
},
11631163
{
@@ -1166,18 +1166,20 @@
11661166
"metadata": {},
11671167
"outputs": [
11681168
{
1169-
"data": {
1170-
"text/plain": [
1171-
"'AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT'"
1172-
]
1173-
},
1174-
"execution_count": 2,
1175-
"metadata": {},
1176-
"output_type": "execute_result"
1169+
"name": "stdout",
1170+
"output_type": "stream",
1171+
"text": [
1172+
"num1=10 and num2=20\n"
1173+
]
11771174
}
11781175
],
11791176
"source": [
1180-
"gene1"
1177+
"# Enter two numbers separated by space\n",
1178+
"values = input()\n",
1179+
"num1, num2 = values.split()\n",
1180+
"num1 = int(num1)\n",
1181+
"num2 = int(num2)\n",
1182+
"print(f'{num1=} and {num2=}')"
11811183
]
11821184
},
11831185
{

0 commit comments

Comments
 (0)