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
96 changes: 81 additions & 15 deletions 01_materials/slides/04_strings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "b922b788",
"metadata": {
"colab": {
Expand All @@ -366,7 +366,18 @@
"id": "b922b788",
"outputId": "a40e63ee-89bb-479e-dc21-c04b53502d2b"
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'apple' == 'Apple'"
]
Expand Down Expand Up @@ -556,7 +567,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "052d6727",
"metadata": {
"id": "052d6727"
Expand All @@ -568,7 +579,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "22261d43",
"metadata": {
"colab": {
Expand All @@ -577,14 +588,25 @@
"id": "22261d43",
"outputId": "98df15ab-64db-4b14-ad0e-3b760beccdc1"
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'R' in job_qualifications"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "0345fd67",
"metadata": {
"colab": {
Expand All @@ -593,14 +615,25 @@
"id": "0345fd67",
"outputId": "26583257-42da-4bab-b326-c7249f67c613"
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"' r ' in job_qualifications"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "c54f65ef",
"metadata": {
"colab": {
Expand All @@ -609,7 +642,18 @@
"id": "c54f65ef",
"outputId": "ede4fcad-d092-46d1-a1ca-ffa1f8a8bec5"
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'JavaScript' in job_qualifications"
]
Expand Down Expand Up @@ -730,10 +774,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "5ae0487a",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"\"Ada Lovelace's initials are A. L.\""
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"first_name = 'Ada'\n",
"last_name = 'Lovelace'\n",
Expand All @@ -751,10 +806,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "05e7baca",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"\"Ada Lovelace's initials are A. L.\""
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"f'Ada Lovelace\\'s initials are {first_name[0]}. {last_name[0]}.'"
]
Expand Down Expand Up @@ -806,7 +872,7 @@
"toc_visible": true
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "python-env",
"language": "python",
"name": "python3"
},
Expand All @@ -820,7 +886,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.11.7"
},
"rise": {
"scroll": true,
Expand Down
88 changes: 76 additions & 12 deletions 02_activities/assignments/assignment_1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,69 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# For testing purposes, we will write our code in the function\n",
"def anagram_checker(word_a, word_b):\n",
" # Your code here\n",
" word_a = word_a.lower()\n",
" word_b = word_b.lower()\n",
"\n",
" return sorted(word_a) == sorted(word_b)\n",
"\n",
"# Run your code to check using the words below:\n",
"anagram_checker(\"Silent\", \"listen\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"anagram_checker(\"Silent\", \"Night\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"anagram_checker(\"night\", \"Thing\")"
]
Expand All @@ -97,22 +134,49 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def anagram_checker(word_a, word_b, is_case_sensitive):\n",
" # Modify your existing code here\n",
" if not is_case_sensitive:\n",
" word_a = word_a.lower()\n",
" word_b = word_b.lower()\n",
" \n",
" return sorted(word_a) == sorted(word_b)\n",
"\n",
"# Run your code to check using the words below:\n",
"anagram_checker(\"Silent\", \"listen\", False) # True"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"False"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"anagram_checker(\"Silent\", \"Listen\", True) # False"
]
Expand All @@ -130,7 +194,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "new-learner",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -144,7 +208,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
Loading