Skip to content

Commit 1b2b64f

Browse files
committed
Update Tuples.ipynb
1 parent e37b3bb commit 1b2b64f

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

Tuples.ipynb

+30-16
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
},
8080
{
8181
"cell_type": "code",
82-
"execution_count": 8,
82+
"execution_count": 1,
8383
"metadata": {},
8484
"outputs": [
8585
{
@@ -96,7 +96,7 @@
9696
"source": [
9797
"thistuple = (\"apple\", \"banana\", \"cherry\")\n",
9898
"print(thistuple[-1])\n",
99-
"print(thistuple[-0])\n",
99+
"print(thistuple[0])\n",
100100
"print(thistuple[-2])\n",
101101
"print(thistuple[-3])"
102102
]
@@ -107,63 +107,64 @@
107107
"metadata": {},
108108
"outputs": [],
109109
"source": [
110-
"thistuple = (\"apple\", \"banana\", \"cherry\")"
110+
"tgyfdfxrdectrs = (\"apple\", \"banana\", \"cherry\")"
111111
]
112112
},
113113
{
114114
"cell_type": "code",
115-
"execution_count": 10,
115+
"execution_count": 2,
116116
"metadata": {},
117117
"outputs": [
118118
{
119119
"name": "stdout",
120120
"output_type": "stream",
121121
"text": [
122-
"('cherry', 'orange', 'kiwi')\n"
122+
"('banana', 'cherry', 'orange', 'kiwi', 'melon')\n"
123123
]
124124
}
125125
],
126126
"source": [
127127
"thistuple = (\"apple\", \"banana\", \"cherry\", \"orange\", \"kiwi\", \"melon\", \"mango\")\n",
128-
"print(thistuple[2:5])"
128+
"print(thistuple[1:6])"
129129
]
130130
},
131131
{
132132
"cell_type": "code",
133-
"execution_count": 11,
133+
"execution_count": 7,
134134
"metadata": {},
135135
"outputs": [
136136
{
137137
"name": "stdout",
138138
"output_type": "stream",
139139
"text": [
140-
"('cherry', 'orange', 'kiwi')\n"
140+
"()\n"
141141
]
142142
}
143143
],
144144
"source": [
145145
"thistuple = (\"apple\", \"banana\", \"cherry\", \"orange\", \"kiwi\", \"melon\", \"mango\")\n",
146-
"print(thistuple[2:5])"
146+
"print(thistuple[:-7])"
147147
]
148148
},
149149
{
150150
"cell_type": "code",
151-
"execution_count": 13,
151+
"execution_count": 9,
152152
"metadata": {},
153153
"outputs": [
154154
{
155155
"name": "stdout",
156156
"output_type": "stream",
157157
"text": [
158-
"['apple', 'kiwi', 'cherry']\n",
159-
"('apple', 'kiwi', 'cherry')\n"
158+
"['apple', 'kiwi', 'banana', 'cherry']\n",
159+
"('apple', 'kiwi', 'banana', 'cherry')\n"
160160
]
161161
}
162162
],
163163
"source": [
164164
"x = (\"apple\", \"banana\", \"cherry\")\n",
165165
"y = list(x)\n",
166-
"y[1] = \"kiwi\"\n",
166+
"\n",
167+
"y.insert(1,\"kiwi\")\n",
167168
"x = tuple(y)\n",
168169
"\n",
169170
"print(y)\n",
@@ -212,12 +213,25 @@
212213
},
213214
{
214215
"cell_type": "code",
215-
"execution_count": 16,
216+
"execution_count": 3,
216217
"metadata": {},
217-
"outputs": [],
218+
"outputs": [
219+
{
220+
"ename": "NameError",
221+
"evalue": "name 'thistuple' is not defined",
222+
"output_type": "error",
223+
"traceback": [
224+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
225+
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
226+
"\u001b[1;32m<ipython-input-3-7255dda8a7d6>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mthistuple\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m\"apple\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"banana\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"cherry\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mdel\u001b[0m \u001b[0mthistuple\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mthistuple\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
227+
"\u001b[1;31mNameError\u001b[0m: name 'thistuple' is not defined"
228+
]
229+
}
230+
],
218231
"source": [
219232
"thistuple = (\"apple\", \"banana\", \"cherry\")\n",
220-
"del thistuple"
233+
"del thistuple\n",
234+
"print(thistuple)"
221235
]
222236
},
223237
{

0 commit comments

Comments
 (0)