Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 186 additions & 32 deletions your-code/challenge-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# Your code here"
"# Your code here\n",
"tup = (\"I\",)"
]
},
{
Expand All @@ -33,11 +34,23 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"tuple"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Your code here"
"# Your code here\n",
"type(tup)"
]
},
{
Expand All @@ -55,13 +68,25 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"('I', 'r', 'o', 'n', 'h', 'a', 'c', 'k')"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Your code here\n",
"\n",
"# Your explanation here\n"
"add = (\"r\", \"o\", \"n\", \"h\", \"a\", \"c\", \"k\")\n",
"# Your explanation here\n",
"tup + add"
]
},
{
Expand All @@ -79,11 +104,12 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"# Your code here\n",
"tup = (\"I\", \"r\", \"o\", \"n\", \"h\", \"a\", \"c\", \"k\")\n",
"\n",
"# Your explanation here\n"
]
Expand All @@ -103,11 +129,24 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 37,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"('I', 'r', 'o', 'n')\n",
"('h', 'a', 'c', 'k')\n"
]
}
],
"source": [
"# Your code here\n"
"# Your code here\n",
"tup1 = tup[0:4]\n",
"print(tup1)\n",
"tup2 = tup[-4:]\n",
"print(tup2)"
]
},
{
Expand All @@ -121,11 +160,32 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 39,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"('I', 'r', 'o', 'n', 'h', 'a', 'c', 'k')\n"
]
},
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Your code here\n"
"# Your code here\n",
"tup3 = tup1 + tup2\n",
"print(tup3)\n",
"tup3 == tup"
]
},
{
Expand All @@ -137,11 +197,23 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 40,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Your code here\n"
"# Your code here\n",
"len(tup1) + len(tup2) == len(tup)"
]
},
{
Expand All @@ -153,11 +225,23 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 52,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"'h'"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Your code here"
"# Your code here\n",
"tup3[4]"
]
},
{
Expand All @@ -177,11 +261,34 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 60,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"('I', 'r', 'o', 'n', 'h', 'a', 'c', 'k')\n",
"True\n",
"False\n",
"True\n",
"False\n",
"False\n"
]
}
],
"source": [
"# Your code here\n"
"# Your code here\n",
"letters = [\"a\", \"b\", \"c\", \"d\", \"e\"]\n",
"\n",
"print(tup3)\n",
"\n",
"for i in letters:\n",
" if i in tup3:\n",
" print(\"True\")\n",
" else:\n",
" print(\"False\")\n",
" "
]
},
{
Expand All @@ -195,11 +302,28 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 82,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"a 1\n",
"b 0\n",
"c 1\n",
"d 0\n",
"e 0\n"
]
}
],
"source": [
"# Your code here\n"
"letters = [\"a\", \"b\", \"c\", \"d\", \"e\"]\n",
"\n",
"for i in letters:\n",
" print(i, tup3.count(i))\n",
"\n",
" "
]
},
{
Expand All @@ -211,12 +335,42 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 85,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10\n",
"11\n",
"12\n",
"13\n",
"14\n",
"15\n",
"16\n",
"17\n",
"18\n",
"19\n",
"20\n"
]
}
],
"source": [
"# Your code here\n"
"# Your code here\n",
"\n",
"tup = (10, 21)\n",
"\n",
"for x in range(*tup):\n",
" print(x)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -235,7 +389,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.8.3"
}
},
"nbformat": 4,
Expand Down
Loading